Ox.$: fix append and prepend

This commit is contained in:
rolux 2013-11-29 22:19:01 +01:00
parent 77594f0046
commit 2fd1892890

View file

@ -49,12 +49,12 @@ Ox.$ = Ox.element = function(value) {
}, },
/*@ /*@
append <f> Appends one or more elements to this element append <f> Appends one or more elements to this element
(element) -> <o> This element (element[, element[, ...]]) -> <o> This element
element <o|[o]> One or more elements element <o> Another element
@*/ @*/
append: function() { append: function() {
var that = this; var that = this;
Ox.makeArray(arguments[0]).forEach(function($element) { Ox.slice(arguments).forEach(function($element) {
that[0].appendChild($element[0]); that[0].appendChild($element[0]);
}); });
return this; return this;
@ -293,12 +293,12 @@ Ox.$ = Ox.element = function(value) {
}, },
/*@ /*@
prepend <f> Prepends one or more elements to this element prepend <f> Prepends one or more elements to this element
(element) -> <o> This element (element[, element[, ...]]) -> <o> This element
element <o|[o]> One or more elements element <o> Another element
@*/ @*/
prepend: function() { prepend: function() {
var parent = this[0].parentNode; var parent = this[0].parentNode;
Ox.makeArray(arguments[0]).reverse().forEach(function($element) { Ox.slice(arguments).reverse().forEach(function($element) {
parent.insertBefore($element[0], parent.firstChild); parent.insertBefore($element[0], parent.firstChild);
}); });
return this; return this;