From 039222f8bf4591807e5d25e2a2308a79f87e656d Mon Sep 17 00:00:00 2001 From: Elijah Manor Date: Mon, 23 Jul 2012 12:23:20 -0500 Subject: [PATCH] Fix IE10 bug when cloning an object element without a parentNode --- src/manipulation.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/manipulation.js b/src/manipulation.js index d118529d4..b755b2f1c 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -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.