Permalink
Browse files

Rebase: revert fixes in master for #11356; #11323

This reverts commit 619f0d9.
This reverts commit f0732c1.
This reverts commit 1ff284d.
  • Loading branch information...
gibson042 committed Mar 6, 2012
1 parent 619f0d9 commit 842427a10c69a8952762405d3a20c4a7c3541f90
Showing with 9 additions and 26 deletions.
  1. +9 −26 src/manipulation.js
View
@@ -644,8 +644,7 @@ jQuery.extend({
},
clean: function( elems, context, fragment, scripts ) {
- var checkScriptType, script, j,
- ret = [];
+ var checkScriptType;
context = context || document;
@@ -654,6 +653,8 @@ 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 += "";
@@ -675,9 +676,7 @@ jQuery.extend({
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
- div = context.createElement("div"),
- safeChildNodes = safeFragment.childNodes,
- remove;
+ div = context.createElement("div");
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
@@ -722,21 +721,6 @@ jQuery.extend({
}
elem = div.childNodes;
-
- // Clear elements from DocumentFragment (safeFragment or otherwise)
- // to avoid hoarding elements. Fixes #11356
- if ( div ) {
- div.parentNode.removeChild( div );
-
- // Guard against -1 index exceptions in FF3.6
- if ( safeChildNodes.length > 0 ) {
- remove = safeChildNodes[ safeChildNodes.length - 1 ];
-
- if ( remove && remove.parentNode ) {
- remove.parentNode.removeChild( remove );
- }
- }
- }
}
}
@@ -765,17 +749,16 @@ jQuery.extend({
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; 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 );
+ 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 ( script.nodeType === 1 ) {
- var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
+ if ( ret[i].nodeType === 1 ) {
+ var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
- fragment.appendChild( script );
+ fragment.appendChild( ret[i] );
}
}
}

0 comments on commit 842427a

Please sign in to comment.