mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Fix #11323. Consistently use rscriptType in jQuery.clean()
This commit is contained in:
committed by
Dave Methvin
parent
1ff284d2cd
commit
f0732c1e41
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user