W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2006

[whatwg] id and xml:id

From: Anne van Kesteren <fora@annevankesteren.nl>
Date: Sun, 02 Apr 2006 14:09:20 +0200
Message-ID: <20060402140920.p32niut7ujgkk0k0@webmail.annevankesteren.nl>
Quoting Henri Sivonen <hsivonen at iki.fi>:
> Also, I suggest requiring that elements must not have both id and  
> xml:id and requiring that xml:id must not occur in the HTML  
> serialization. (Again, from the document conformance point of view-- 
> not disputing requirements on browsers.)

How could it occur in a HTML document? (Given that the browser in question is
namespace aware.) I'm assuming here that we're not talking about adding stuff
through the DOM given that you talk about serialization.


> Rationale:
> HTML doesn't have namespace processing of colonified names and the  
> xml:id spec is not designed for HTML. Allowing xml:id in HTML feels  
> intuitively wrong (perhaps even a bit evil :-).

I agree.


> If an element had both an id attribute and an xml:id attribute with  
> different values, the document would not be HTML-serializable, which  
> would be bad.

Now I agree that's bad, but I think there is something to say for elements
having multiple IDs. (Even though that's not valid for some definition of it.)


> (Obviously, even with only one kind of ID attribute on  an element, 
> in round tripping from XHTML to HTML to XHTML, the  information about 
> whether the original attribute was id or xml:id is  lost just like 
> the information about whether a table had a tbody is  lost.)

Interesting point. I think <tbody> should be required in XHTML 
personally to go
against that. It just doesn't make sense the way it is now.


> If an element was allowed to have an id attribute and an xml:id  
> attribute with the same value, the following constraint from xml:id  
> spec would be violated even for conforming docs:
> "An xml:id processor should assure that the following constraint holds:
>     * The values of all attributes of type ?ID? (which includes 
> all  xml:id attributes) within a document are unique."
> ( http://www.w3.org/TR/xml-id/ )
> Assuming, of course, that the XHTML5 id can still be considered an ID 
>  in the XML sense.

It should be considered an ID in the XML sense for getElementByID and friends.


> Finally, as the ultimate ID nitpicking, the spec should state that it 
>  is naughty of authors to turn attributes other than id and xml:id  
> into IDs via the DTD. (Well, using a DTD at all is naughty. :-)

But through DOM methods is ok? (I agree that DTDs are obsolete...)


> Test case: http://hsivonen.iki.fi/test/wa10/adhoc/id.html

Interesting testcase!


> Opera (weekly build 3312; note that Opera recently changed its  
> behavior to match the others with id=' c '):

Bah. I hope we can revert that... Do you have a similar test for xml:id? Opera
does (did?) passes the following for example:

http://annevankesteren.nl/test/xml/xml-id/008.xml

Cheers,

Anne


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
Received on Sunday, 2 April 2006 05:09:20 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:46 UTC