mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
JSLint failed due to function created within for loop
This commit is contained in:
parent
0d8b247cab
commit
73f9ab6705
@ -553,6 +553,8 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
clean: function( elems, context, fragment, scripts ) {
|
clean: function( elems, context, fragment, scripts ) {
|
||||||
|
var checkScriptType;
|
||||||
|
|
||||||
context = context || document;
|
context = context || document;
|
||||||
|
|
||||||
// !context.createElement fails in IE with an error but returns typeof 'object'
|
// !context.createElement fails in IE with an error but returns typeof 'object'
|
||||||
@ -630,15 +632,16 @@ jQuery.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( fragment ) {
|
if ( fragment ) {
|
||||||
|
checkScriptType = function( elem ) {
|
||||||
|
return !elem.type || rscriptType.test( elem.type );
|
||||||
|
};
|
||||||
for ( i = 0; ret[i]; i++ ) {
|
for ( i = 0; ret[i]; i++ ) {
|
||||||
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
|
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
|
||||||
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
|
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ( ret[i].nodeType === 1 ) {
|
if ( ret[i].nodeType === 1 ) {
|
||||||
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), function( elem ) {
|
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
|
||||||
return !elem.type || rscriptType.test( elem.type );
|
|
||||||
});
|
|
||||||
|
|
||||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user