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

Re: Placing elements in the HTML namespace

From: Doug Schepers <schepers@w3.org>
Date: Fri, 23 Jan 2009 13:59:03 -0500
Message-ID: <497A1377.6080207@w3.org>
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:

    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?

[3] http://schepers.cc/svg/blendups/scriptbridge/scriptbridge.html

-Doug Schepers
W3C Team Contact, SVG and WebApps WGs
Received on Friday, 23 January 2009 18:59:15 UTC

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