Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix #11356. Avoid hoarding elements in DocumentFragments.

  • Loading branch information...
commit 1ff284d2cd67f2f4e7cd8b9577191ba80d521763 1 parent 5cae50e
@rwaldron rwaldron authored dmethvin committed
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/manipulation.js
View
15 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 );
+ }
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.