Skip to content

Commit

Permalink
Ensure that createElement does not return nodes with Parents (Fixes a…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Apr 16, 2014
1 parent c163f8d commit 955fbcf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/html5shiv.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@
// a 403 response, will cause the tab/window to crash
// * Script elements appended to fragments will execute when their `src`
// or `text` property is set
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
if (node.canHaveChildren && !reSkip.test(nodeName)) {
// Return a cloned copy of the shived node to ensure that it is not part
// of the DOM - this is in compliance with native createElement.
return data.frag.appendChild(node).cloneNode(true);
} else {
return node;
}
}

/**
Expand Down

0 comments on commit 955fbcf

Please sign in to comment.