// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
+ l = this.length,
i = 0;
- for ( ; ( elem = this[ i ] ) != null; i++ ) {
+ for ( ; i < l; i++ ) {
+ elem = this[ i ];
+
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
empty: function() {
var elem,
+ l = this.length,
i = 0;
- for ( ; ( elem = this[ i ] ) != null; i++ ) {
+ for ( ; i < l; i++ ) {
+ elem = this[ i ];
+
if ( elem.nodeType === 1 ) {
// Prevent memory leaks
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var destElements, srcElements, node, i,
+ var destElements, srcElements, i, l,
inPage = jQuery.contains( elem.ownerDocument, elem ),
clone = elem.cloneNode( true );
destElements = getAll( clone );
srcElements = getAll( elem );
- for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
- fixCloneNodeIssues( node, destElements[ i ] );
+ for ( i = 0, l = srcElements.length; i < l; i++ ) {
+ fixCloneNodeIssues( srcElements[ i ], destElements[ i ] );
}
}
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
- for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
- cloneCopyEvent( node, destElements[ i ] );
+ for ( i = 0, l = srcElements.length; i < l; i++ ) {
+ cloneCopyEvent( srcElements[ i ], destElements[ i ] );
}
} else {
cloneCopyEvent( elem, clone );
},
clean: function( elems, context, fragment, scripts, selection ) {
- var elem, i, j, tmp, tag, wrap,
+ var elem, i, j, ll, tmp, tag, wrap,
+ l = elems.length,
ret = [],
container = context === document && fragment;
context = document;
}
- for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
+ for ( i = 0; i < l; i++ ) {
+ elem = elems[ i ];
+
if ( elem || elem === 0 ) {
+
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
core_push.apply( ret, elem.nodeType ? [ elem ] : elem );
}
if ( fragment ) {
- for ( i = 0; ( elem = ret[ i ] ) != null; i++ ) {
+ for ( i = 0, l = ret.length; i < l; i++ ) {
+ elem = ret[ i ];
container = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
// Capture executables
if ( scripts ) {
- for ( j = 0; ( elem = tmp[ j ] ) != null; j++ ) {
+ for ( j = 0, ll = tmp.length; j < ll; j++ ) {
+ elem = tmp[ j ];
+
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
cleanData: function( elems, /* internal */ acceptData ) {
var data, id, elem, type,
i = 0,
+ l = elems.length,
internalKey = jQuery.expando,
cache = jQuery.cache,
special = jQuery.event.special;
- for ( ; ( elem = elems[ i ] ) != null; i++ ) {
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
if ( acceptData || jQuery.acceptData( elem ) ) {
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
+
if ( match ) {
elem.type = match[ 1 ];
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
- var elem,
- i = 0;
- for ( ; ( elem = elems[ i ] ) != null; i++ ) {
- jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[ i ], "globalEval" ) );
+ var i = 0,
+ l = elems.length;
+
+ for ( ; i < l; i++ ) {
+ jQuery._data( elems[ i ], "globalEval", !refElements || jQuery._data( refElements[ i ], "globalEval" ) );
}
}