HIERARCHY_REQUEST_ERR on document.replaceChild - by Stephen McKamey

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


ID 626473 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 12/1/2010 12:44:31 PM
Access Restriction Public

Description

IE9 beta doesn't allow the HTML node to be replaced via DOM methods. This worked fine in IE8 and earlier.

	var newHtmlNode = document.createElement("html");
	// build document...

	document.replaceChild(newHtmlNode, document.documentElement);

// or alternatively

	for (var i=document.childNodes.length-1; i >= 0; i--) {
		var child = document.childNodes[i];
		if (document.documentElement === child) {
			try {
				document.replaceChild(newHtmlNode, child);
			} catch (ex) {
				alert(ex);
			}
			break;
		}
	}
Sign in to post a comment.
Posted by Microsoft on 3/7/2011 at 5:37 PM
Thank you for your feedback.

This issue was resolved in Internet Explorer 9 RC and the Platform Preview Build released on 2/10/2011. Please verify the change and file a new feedback (or reactivate the existing one) if the problem persists.

Best regards,

The Internet Explorer Team
Posted by Stephen McKamey on 3/3/2011 at 5:39 PM
This appears to be fixed in IE9 RC1.
Posted by Microsoft on 12/17/2010 at 1:08 PM
Thank you for your feedback.

We were able to reproduce the issue and are investigating it.

Best regards,

The Internet Explorer Team
Posted by Stephen McKamey on 12/1/2010 at 2:48 PM
Note that when using the developer tools to switch the "Document Mode", it works as expected in all modes except "IE9 standards".