aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 35c9544ff..bc2af18dc 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -20,7 +20,23 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
- };
+ },
+ safeFragment = (function() {
+ var nodeNames = (
+ "abbr article aside audio canvas datalist details figcaption figure footer " +
+ "header hgroup mark meter nav output progress section summary time video"
+ ).split( " " ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( nodeNames.length ) {
+ safeFrag.createElement(
+ nodeNames.pop()
+ );
+ }
+ }
+ return safeFrag;
+ })();
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
@@ -625,6 +641,9 @@ jQuery.extend({
depth = wrap[0],
div = context.createElement("div");
+ // Append wrapper element to unknown element safe doc fragment
+ safeFragment.appendChild( div );
+
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];