Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 6f5fc55

Browse files
committed
refactor(jqLite): simplify jqLiteAddNodes when multiple nodes are being added
This branch is not as hot as the single node branch and the slice that we need for old webkit/phantom makes for loop preferable.
1 parent 0d608d0 commit 6f5fc55

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: src/jqLite.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,9 @@ function jqLiteAddNodes(root, elements) {
400400
// if an Array or NodeList and not a Window
401401
if (typeof length === 'number' && elements.window !== elements) {
402402
if (length) {
403-
if (elements.item) {
404-
// convert NodeList to an Array to make PhantomJS 1.x happy
405-
elements = slice.call(elements);
403+
for (var i = 0; i < length; i++) {
404+
root[root.length++] = elements[i];
406405
}
407-
push.apply(root, elements);
408406
}
409407
} else {
410408
root[root.length++] = elements;

0 commit comments

Comments
 (0)