Closed
Bug 40965
Opened 25 years ago
Closed 25 years ago
cannot copy nodes from iframe to parent document.
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
VERIFIED
WORKSFORME
People
(Reporter: zoltan, Assigned: jst)
References
()
Details
This code worked for M14 but not M15. I think it's a bug with this particular
build, and hopefully it's my perception of the DOM Level 1 that just happened
to work in M14.
I have written a function called "replace_html()" that takes one parameter,
which is an HTML string. The purpose of this function is to replace the contents
of the <div id="obj1"> container to that HTML string, kind of how the IE4 DOM's
innerHTML function does, and how the NS4's layer.obj1.document.write did in
NS4's DOM. It does this by writing the HTML into the iframe called "test" and
pruning the body's subtree of that iframe (which has a <div id="obj1">) and
appending it to the end of the main document.
This works in M14. In M15, it works the first time you use the function, but
fails to work the second time (and every time after).
Try the URL http://www.attcanada.ca/example/sample.html using M14 and you'll see
it work as intended. Note: When I refer to M14 and M15, I am referring to the
Windows 98 version.
Reporter | ||
Comment 1•25 years ago
|
||
One thing I forgot to mention the first time ... if you go to the URL Provided,
this can be illustated as follows: click
on one of the two links at the top of the page: you will see that the red box on
the screen changes content (this is div id="obj1"). Click on the other link.
In M14, it will change again. In M15, it will just disappear.
Assignee | ||
Comment 2•25 years ago
|
||
For the record, this is not supposed to work, the DOM spec says if a node is
inserted into another node, the DOM implementation should throw the
WRONG_DOCUMENT_ERR exception if the inserted node comes from another document
than the node it's being inserted into. Don't assume this will work, I was under
the impression that this would still work in mozilla but the constraints might
very well be tightened WRT moving nodes from one document to another in mozilla.
DOM Level 2 defines an importNode method in the document interface and that
should be used when moving nodes from one document to another and that method
should be used in a case like this, unfortunately it's not implemented in
mozilla yet.
In other words, this should probably be fixed since there's no way around this
problem.
Assignee | ||
Comment 3•25 years ago
|
||
BTW, mozilla does have .innerHTML now and it works just like the IE version.
Assignee | ||
Comment 4•25 years ago
|
||
... but you need to grab a nightly build to use that, it's not in M15.
Assignee | ||
Comment 5•25 years ago
|
||
Looks like this works now, marking WORKSFORME
Status: UNCONFIRMED → RESOLVED
Closed: 25 years ago
Resolution: --- → WORKSFORME
Comment 7•25 years ago
|
||
Works for me:
Platform: PC
OS: Windows 98
Mozilla Build: 2000101214 M18 Trunk Build
Marking as Verified.
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•