[whatwg] id and xml:id

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:




Anne van Kesteren

Received on Sunday, 2 April 2006 05:09:20 UTC