aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-04-12 18:30:21 -0400
committertimmywil <tim.willison@thisismedium.com>2011-04-12 18:30:21 -0400
commit73f9ab67058d2dc14ab81c62bd9b228b0e1cad93 (patch)
tree1471917d977bc6c29f10f9660a6cf7f3ade08395 /src/manipulation.js
parent0d8b247cab2f91e118d0b734028ce827e09a71f7 (diff)
downloadjquery-73f9ab67058d2dc14ab81c62bd9b228b0e1cad93.tar.gz
jquery-73f9ab67058d2dc14ab81c62bd9b228b0e1cad93.zip
JSLint failed due to function created within for loop
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 52d59d83e..711cb5e88 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -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 ) );
}