W3C home > Mailing lists > Public > public-html@w3.org > January 2009

Re: Placing elements in the HTML namespace

From: Jonas Sicking <jonas@sicking.cc>
Date: Fri, 23 Jan 2009 11:12:54 -0800
Message-ID: <497A16B6.40804@sicking.cc>
To: Doug Schepers <schepers@w3.org>
CC: Maciej Stachowiak <mjs@apple.com>, Boris Zbarsky <bzbarsky@mit.edu>, Anne van Kesteren <annevk@opera.com>, HTML WG <public-html@w3.org>

Doug Schepers wrote:
> 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:
> [[
>     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

I think at best it can be said that the spec is vague in this area. In 
practice it doesn't matter though. At this point browsers have to 
support moving nodes between documents, not supporting that "breaks the 
web". This despite the fact that IE many times does not support moving 
nodes between documents. Too many pages have non-IE specific code paths 
that break if nodes can't be moved between documents.

In firefox we recently tried to follow the interpretation in the spec 
that says that nodes can never be implicitly moved between documents. We 
ended up having to revert that patch after a few months due to many 
sites breaking.

/ Jonas
Received on Friday, 23 January 2009 19:13:48 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:41 UTC