Skip to content
Permalink
Browse files

Fix #11356. Avoid hoarding elements in DocumentFragments.

  • Loading branch information
rwaldron authored and dmethvin committed Mar 2, 2012
1 parent 5cae50e commit 1ff284d2cd67f2f4e7cd8b9577191ba80d521763
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/manipulation.js
@@ -676,7 +676,9 @@ jQuery.extend({
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
div = context.createElement("div"),
safeChildNodes = safeFragment.childNodes,
remove;

// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
@@ -721,6 +723,17 @@ jQuery.extend({
}

elem = div.childNodes;

// Clear elements from DocumentFragment (safeFragment or otherwise)
// to avoid hoarding elements. Fixes #11356
if ( div ) {
div.parentNode.removeChild( div );
remove = safeChildNodes[ safeChildNodes.length - 1 ];

if ( remove && remove.parentNode ) {
remove.parentNode.removeChild( remove );
}
}
}
}

2 comments on commit 1ff284d

@dmethvin

This comment has been minimized.

Copy link
Member

@dmethvin dmethvin replied Mar 6, 2012

Looks like this commit caused a regression in Firefox 3.6 of all places. @rwldrn can you take a look?

http://jsfiddle.net/79gBB/1/

@rwaldron

This comment has been minimized.

Copy link
Member Author

@rwaldron rwaldron replied Mar 6, 2012

I'll dig in to this now

Please sign in to comment.
You can’t perform that action at this time.