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: Thu, 15 Jan 2009 20:35:17 -0800
Message-ID: <63df84f0901152035q36283390v94f62f32e7a402c0@mail.gmail.com>
To: "Maciej Stachowiak" <mjs@apple.com>
Cc: "Boris Zbarsky" <bzbarsky@mit.edu>, "Anne van Kesteren" <annevk@opera.com>, "HTML WG" <public-html@w3.org>

On Thu, Jan 15, 2009 at 7:53 PM, Maciej Stachowiak <mjs@apple.com> wrote:
>
> On Jan 15, 2009, at 7:40 PM, Jonas Sicking wrote:
>
>> Maciej Stachowiak wrote:
>>>
>>> On Jan 15, 2009, at 7:34 AM, Boris Zbarsky wrote:
>>>>
>>>> Anne van Kesteren wrote:
>>>>>
>>>>> Though for CSS purposes all three treat HTML as being in the (X)HTML
>>>>> namespace last time I checked.
>>>>
>>>> Right.  Gecko has a concept of "html element" that is distinct from the
>>>> namespace, and this is used to force such elements to match CSS selectors in
>>>> the XHTML namespace.
>>>>
>>>> However, there are two differences between XHTML and HTML in Gecko last
>>>> I checked (in 2005, but I don't think we've changed these):
>>>>
>>>> 1)  frames/iframes.  For XHTML we use the id attribute value as the
>>>>  window name, for HTML we use the name attribute value.  Should this
>>>>  be based on the document type instead?  Or something else?
>>>> 2)  Serializing XML -- for XHTML we set shorthand attrs to be
>>>>  |foo="foo"| while for HTML we set them to just be |foo|.
>>>>  This only affects people calling the XML serializer on a DOM coming
>>>>  from text/html, but that sounds like something HTML5 wants to
>>>>  support.
>>>
>>> In WebKit we implement all HTML/XHTML differences based on whether the
>>> containing document is an HTML or XML document. The element objects
>>> themselves are indistinguishable.
>>
>> Wouldn't that mean that they change name when moved between documents?
>> From 'div' to 'DIV'?
>
> Yes, Node.nodeName and Element.tagName would change from lowercase to
> uppercase if the same element is moved from an XML document to an HTML
> document. Node.localName would remain consistently lowercase.

This seems a bit strange to me. It also seems strange that behavior of
things like getElementsByTagName changes with the ownerDocument rather
than being intrinsic to the node itself.

> 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.

That's not entirely true. Even DOM specs allow you to move a node
between documents using adoptNode. There is also the importNode
function, which doesn't move a node between documents, but is supposed
to clone a node which is supposed to yield a node with the same name.

/ Jonas
Received on Friday, 16 January 2009 04:35:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:28 GMT