- From: Doug Schepers <schepers@w3.org>
- Date: Fri, 23 Jan 2009 13:59:03 -0500
- To: Maciej Stachowiak <mjs@apple.com>
- CC: Jonas Sicking <jonas@sicking.cc>, Boris Zbarsky <bzbarsky@mit.edu>, Anne van Kesteren <annevk@opera.com>, HTML WG <public-html@w3.org>
Hi, Maciej- Maciej Stachowiak wrote (on 1/15/09 10:53 PM): > > Note also that according to the spec the DOM elements cannot ever move > between documents, but browsers (including WebKit-based ones) do widely > allow this. I think this may be a misinterpretation of DOM2 Core, which is understandable, as the wording is a bit vague here. appendChild, insertBefore, replaceChild, setNamedItem, setNamedItemNS, setAttributeNode, setAttributeNodeNS, and createDocument all raise a WRONG_DOCUMENT_ERR, under certain circumstances, but the reason for that is not necessarily that the node has moved from one document to another. The DOMException ExceptionCode for WRONG_DOCUMENT_ERR (in both DOM2 Core [1] and DOM3 Core [2]) is more explicit than the descriptions in those methods regarding what a "different document" is; it states: [[ WRONG_DOCUMENT_ERR If a node is used in a different document than the one that created it (that doesn't support it) ]] Note the parenthetical.... I interpret this to mean not a different individual document of the same type, but one of a different type. For example, if I created a <path> in a SVG document, and tried to insert it in an HTML document (which doesn't yet support SVG elements), it might raise this exception (at least, until SVG-in-HTML is clarified); if I tried to append that same <path> in another SVG element [3], it should not raise that exception. Does that make sense? [1] http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-258A00AF [2] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMException-WRONG_DOCUMENT_ERR [3] http://schepers.cc/svg/blendups/scriptbridge/scriptbridge.html Regards- -Doug Schepers W3C Team Contact, SVG and WebApps WGs
Received on Friday, 23 January 2009 18:59:15 UTC