diff options
author | Oleg <markelog@gmail.com> | 2013-01-08 01:59:01 +0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2013-01-08 02:41:25 +0000 |
commit | 57d9dcd4a0c3a56160144b7f468fff6e419fed84 (patch) | |
tree | b9a25893e30bbcdce7f5f88ffea350e1273ff081 | |
parent | 58b4994f5634b839cb6cafa1457da7eb5c5a9c7c (diff) | |
download | jquery-57d9dcd4a0c3a56160144b7f468fff6e419fed84.tar.gz jquery-57d9dcd4a0c3a56160144b7f468fff6e419fed84.zip |
Use while loop instead of for
-rw-r--r-- | src/manipulation.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 3ddd56c3a..c85caa060 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -422,16 +422,12 @@ jQuery.extend({ }, buildFragment: function( elems, context, scripts, selection ) { - var elem, tmp, tag, wrap, j, ll, contains, - fragment = context.createDocumentFragment(), + var elem, tmp, tag, wrap, contains, j, i = 0, - l = elems.length, + fragment = context.createDocumentFragment(), nodes = []; - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { + while ( ( elem = elems[ i++ ] ) || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { @@ -465,14 +461,13 @@ jQuery.extend({ // Support: Webkit, IE tmp.textContent = ""; } - } } // Remove wrapper from fragment fragment.textContent = ""; - for ( i = 0, l = nodes.length; i < l; i++ ) { - elem = nodes[ i ]; + i = 0; + while ( (elem = nodes[ i++ ]) ) { contains = jQuery.contains( elem.ownerDocument, elem ); // #4087 - If origin and destination elements are the same, and this is @@ -491,9 +486,9 @@ jQuery.extend({ // Capture executables if ( scripts ) { - for ( j = 0, ll = tmp.length; j < ll; j++ ) { - elem = tmp[ j ]; + j = 0; + while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { core_push.call( scripts, elem ); } |