Bug 12339 - XML DOM operations involving two documents don't match IE/Firefox behavior
Summary: XML DOM operations involving two documents don't match IE/Firefox behavior
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 10489
  Show dependency treegraph
 
Reported: 2007-01-19 22:24 PST by Jesse Costello-Good
Modified: 2022-08-05 15:16 PDT (History)
6 users (show)

See Also:


Attachments
test case (449 bytes, text/html)
2009-02-16 02:47 PST, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Costello-Good 2007-01-19 22:24:22 PST
I think that Safari probably has the more spec-compliant implementation but I report this for the sake of cross-browser AJAX compatibility.

appendChild, insertBefore, replaceChild, and setAttributeNode (could there be more?) fail when the argument is a node from a different XML document. In IE and Fx these methods behave as though the nodes are in the same document. No special logic is necessary to test whether the ownerDocument property of the two nodes is the same.

The work around is to use importNode(), call one of the above methods passing in the imported node, and remove the argument node from its parent node in the other document.
Comment 1 Maciej Stachowiak 2007-02-16 20:48:24 PST
Our behavior is more spec-compliant. We would consider changing it, but I think Firefox at least is considering changing to match the spec more closely instead
Comment 2 Alexey Proskuryakov 2009-02-16 02:47:02 PST
Created attachment 27689 [details]
test case

On this test case, WebKit and IE7 raise an exception, while Firefox 3.1b2 and Opera 9.63 do not. I'm not sure if that's the case reported here.
Comment 3 Alexey Proskuryakov 2009-02-16 02:47:51 PST
See also: bug 4569.
Comment 4 Johan "Spocke" Sörlin 2009-08-26 08:33:37 PDT
I don't think this is a bug. You should use importNode if you want to add a node from one document to another according to W3C specs.
Comment 5 Lucas Forschler 2019-02-06 09:03:21 PST
Mass moving XML DOM bugs to the "DOM" Component.
Comment 6 Ahmad Saleem 2022-08-05 15:16:37 PDT
I am unable to reproduce this bug based on expected results since the behavior of Safari 15.6 on macOS 12.5 matches with other browsers (Chrome Canary 106 and Firefox Nightly 105) on attached test cases. It shows a dialog box with "P" in it and then show two empty iframe and it is same across all browsers.

Since all browsers are working same, I am going to mark this as "RESOLVED CONFIGURATION CHANGED" expecting that something along the lien fixed it.

In case if I am testing incorrectly, please reopen this bug. Thanks!