aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 954d52edf..159c4c488 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -644,7 +644,8 @@ jQuery.extend({
},
clean: function( elems, context, fragment, scripts ) {
- var checkScriptType;
+ var checkScriptType, script, j,
+ ret = [];
context = context || document;
@@ -653,8 +654,6 @@ jQuery.extend({
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
- var ret = [], j;
-
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
@@ -762,16 +761,17 @@ jQuery.extend({
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] );
+ script = ret[i];
+ if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
+ scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
} else {
- if ( ret[i].nodeType === 1 ) {
- var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
+ if ( script.nodeType === 1 ) {
+ var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
- fragment.appendChild( ret[i] );
+ fragment.appendChild( script );
}
}
}