Re: ID Characters (was: Re: 3.4. Global attributes)

On Aug 1, 2007, at 10:32 AM, Anne van Kesteren wrote:

>
> On Wed, 01 Aug 2007 17:18:42 +0200, Robert Burns <rob@robburns.com>  
> wrote:
>> "The value must be unique in the subtree within which the element  
>> finds itself and must contain at least one character."
>>
>> I'm not sure I understand what this means, but it sounds to me  
>> like @id attributes need only be unique within a particular node  
>> (or within a depth traversal of a node)?
>
> It would be good if subtree were defined. I think it is meant  
> (besides document uniqueness) to also cover cases like  
> DocumentFragment, etc.

So are you saying that HTML5 @id values need only be unique within a  
document fragment?

Would this be conforming since the IDs do not collide in the same  
subtree?

...
<article>
<dvf id='an-article' >…</div>
</article>
<div id='an-article' >…</div>
...

>> "This specification doesn't preclude an element having multiple  
>> IDs, if other mechanisms (e.g. DOM Core methods) can set an  
>> element's ID in a way that doesn't conflict with the id attribute."
>>
>> Again, I don't really understand what this paragraph is saying. Is  
>> this multiple attributes with different names all taking a value  
>> of type ID?
>
> It is about multiple _attributes_ of type ID. For instance:
>
>   <div id="foo" xml:id="bar">
>
> (Although it seems that implementations are leaning towards not  
> supporting multiple attributes of type ID at all for performance  
> reasons. (See the Gecko bug on xml:id for more information.))

XML 1.0 forbids multiple attributes of type ID on the same element.  
That does not preclude using @id and @xml:id in the same document, it  
just precludes assigning both to the same element. That combined with  
the performance issues you mention suggests to me we should simply  
disallow the assignment of two different ID attributes on the same  
element.

>> Also, what are the use-cases this is trying to address. Why would  
>> we need to have multiple @id attributes on the same element?
>
> It's there to clarify that the specification does not forbid xml:id  
> if I remember correctly.

We could perhaps specify that authors (in an XML serialized document)  
can use either @id or @xml:id on an element, but not both.

>> I don't think this really is related to DTD or RelaxNG or XSD,  
>> etc. However, I look at the HTML4 recommendation and the XML 1  
>> recommendation and we do not appear to fit in with respect to ID.  
>> That doesn't sound like a good thing (in terms of document  
>> conformance).
>
> That's because the HTML4 and XML attributes of type ID are based on  
> DTDs, as Henri explained. We're not constrained by that.

Whatever the origins and rationales for this of the XML1 and HTML4  
recommendations, we should take that as is. I already said I don't  
think we should feel bound to the DTD, RelaxNG or XSD specifications.  
However since we're trying to make HTML5 compatible with HTML4 and  
XML1, shouldn't we make our document conformance meet those  
recommendations? I don't think we're helping authors by giving them  
the ability to start and ID value with a number. If they cannot do  
that, they'll find ways around it (after all, these are opaque values  
anyway). However, we could be opening authors up to headaches if we  
permit or encourage that usage.

Take care,
Rob

Received on Wednesday, 1 August 2007 15:48:30 UTC