RESOLVED INVALID 31029
Cannot add AJAX loaded content in hierarchy without clone it.
https://bugs.webkit.org/show_bug.cgi?id=31029
Summary Cannot add AJAX loaded content in hierarchy without clone it.
chameleon
Reported 2009-11-02 13:19:21 PST
I load XHTML with following code: var xmlHttp = new XMLHttpRequest(); xmlHttp.open("GET", '?a=3', false); xmlHttp.send(null); Then replace a node in document with loaded content: var where = document.getElementById('here_for_webkit_only'); where.parentNode.replaceChild(xmlHttp.responseXML.documentElement, where); FAIL!!!! I must use: var where = document.getElementById('here_for_webkit_only'); where.parentNode.replaceChild(xmlHttp.responseXML.documentElement.cloneNode(true), where); SUCCESS!!!! Is there a special reason for this? Check it online at given URL. (the third bug in a row)
Attachments
Alexey Proskuryakov
Comment 1 2009-11-02 14:47:11 PST
Yes, our behavior is in accordance with DOM 3 Core specification, please see <http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-785887307>: "WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node." I would actually suggest that you use importNode, not cloneNode, as that avoids the need to make copies, and is faster. Resolving as INVALID, because our behavior appears correct per the spec, and we are not aware of actual sites broken by this (which would make us consider diverging from the spec).
chameleon
Comment 2 2009-11-02 16:06:10 PST
You are right. Sorry for false alert.
Lucas Forschler
Comment 3 2019-02-06 09:02:49 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note You need to log in before you can comment on or make changes to this bug.