Permalink
Browse files

Fix IE10 bug when cloning an object element without a parentNode

  • Loading branch information...
1 parent 09fc2c5 commit 039222f8bf4591807e5d25e2a2308a79f87e656d @elijahmanor elijahmanor committed Jul 23, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/manipulation.js
View
@@ -440,7 +440,13 @@ function cloneFixAttributes( src, dest ) {
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
- dest.outerHTML = src.outerHTML;
+ // The official HTML5 specs read that a NO_MODIFICATION_ALLOWED_ERR
+ // needs to be thrown if the parent is a Document
+ // http://html5.org/specs/dom-parsing.html#dom-element-outerhtml
+ // IE10 throws NoModificationAllowedError if parent node is null
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.

0 comments on commit 039222f

Please sign in to comment.