RE: IE-only "unknown runtime error" when using replaceChild
"Ryan Hicks" <[email protected]> Tue, 30 Jan 2007 14:59:44 -0800
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
Hey Charles..
I don't have an answer, but it may help that I failed to reproduce what
you're seeing with the following file (which correctly shows "cover" instead
of "original"):
<html><body>
<div id="d1"><div id="d2">original</div></div>
<script>
var oElement = document.getElementById("d2");
var html = "cover";
var oParentEl = oElement.parentNode;
var oTempEl = document.createElement('div');
oElement.parentNode.replaceChild(oTempEl, oElement);
oTempEl.innerHTML = html;
</script>
</body></html>
There must be something more to it than what's in the code you sent. I'd
guess that it may have more to do with what you're trying to insert than
what you're trying to insert it into?
-ryan
_____
From: [email protected] [mailto:[email protected]] On Behalf Of
Charles Wiltgen
Sent: Tuesday, January 30, 2007 2:43 PM
To: [email protected]
Subject: [wdf-dom] IE-only "unknown runtime error" when using replaceChild
Hello,
I'm working on Objecty, a script that makes it easy to embed video in
a page and adds other interesting, format-agnostic abilities at the
same time. It'll be free.
This code replaces the original tag with a <div> containing a (for
example) QuickTime Movie. It works in everything except IE. In IE,
the Movie appears centered at the top-left corner of the window in IE.
var oParentEl = oElement.parentNode;
var oTempEl = document.createElement('div');
oTempEl.innerHTML = html;
oElement.parentNode.replaceChild(oTempEl, oElement);
This seems like an obvious IE bug. My theory is that for IE I should
split this into two steps, first inserting the <div> into the
document, then the <div> contents after that.
Unfortunately, this code also works in everything but IE, where it
gives me an "unknown runtime error". Literally, IE just fails without
spitting out a specific error message.
// replace original <object> _then_ insert content
var oParentEl = oElement.parentNode;
var oTempEl = document.createElement('div');
oElement.parentNode.replaceChild(oTempEl, oElement);
oTempEl.innerHTML = html;
It fails during the last line. The same code works fine in Firefox
and Opera for Windows.
I apologize for not lurking for a bit before posting, but I'm dying to
release a beta this week, and I've banged my head on this for hours.
-- Charles
[Non-text portions of this message have been removed]