]> source.dussan.org Git - jquery.git/commitdiff
JSLint failed due to function created within for loop 321/head
authortimmywil <tim.willison@thisismedium.com>
Tue, 12 Apr 2011 22:30:21 +0000 (18:30 -0400)
committertimmywil <tim.willison@thisismedium.com>
Tue, 12 Apr 2011 22:30:21 +0000 (18:30 -0400)
src/manipulation.js

index 52d59d83ed2a52f366c66ebe9a15f704b48723e5..711cb5e8804ae86fdbb90be147413560dda106fd 100644 (file)
@@ -553,6 +553,8 @@ jQuery.extend({
        },
 
        clean: function( elems, context, fragment, scripts ) {
+               var checkScriptType;
+
                context = context || document;
 
                // !context.createElement fails in IE with an error but returns typeof 'object'
@@ -630,15 +632,16 @@ jQuery.extend({
                }
 
                if ( fragment ) {
+                       checkScriptType = function( elem ) {
+                               return !elem.type || rscriptType.test( elem.type );
+                       };
                        for ( i = 0; ret[i]; i++ ) {
                                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] );
 
                                } else {
                                        if ( ret[i].nodeType === 1 ) {
-                                               var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), function( elem ) {
-                                                       return !elem.type || rscriptType.test( elem.type );
-                                               });
+                                               var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
 
                                                ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
                                        }