Re: Fragment identifiers and 'ID' attribute values: case matters

Bjoern Hoehrmann wrote:

> Thus the value of the id attribute in HTML 4 is case-insensitive.

No, not quite.  An author may write the 'ID' attribute value specification with lower-case 
letters, true.  But the resultant attribute value has all letters in upper case.  It does not 
even make sense to talk of the value itself as case-sensitive or -insensitive.  The 
processes and applications which use the value may be case-sensitive or -insensitive.

> The HTML 4 recommendation says, the value is case-sensitive.

Then processes and applications which use the value must be case-sensitive.

> Either the prose or the SGML declaration is in error in this case.

I do not find a contradiction.

> I guess the
> prose represents the intent of the working group, but it is not possible
> to force an SGML processor to treat IDs case-sensitive, while treating
> other names (entity names are the exception) case-insensitive, hence one
> cannot require them to in the prose.

The prose may contain traps for the unwary, but it is not in error.

> The problem is the
> name attribute value of some elements that also acts as anchor in HTML
> documents. It's also described as case-sensitive in the prose. In
> consequence this is an error. IDs and names are said to share the same
> namespace, they cannot do so, if they do not have the same rules about
> case-sensitivity.

The two attributes certainly may share the same namespace even if their preprocessing 
requirements differ.  The trick for authors is to write proper attribute specifications.  
Consider the following start tags and their status in HTML4.

<A ID="AnElement"> Legal: anchor name is "ANELEMENT".
<A NAME="AnElement"> Legal: anchor name is "AnElement".
<A ID="AnElement" NAME="AnElement"> Illegal: anchor names differ only in case.
<A ID="AnElement" NAME="ANELEMENT"> Legal: anchor names are identical.

The HTML4 specification gets this incorrect in an example.

Wisdom dictates that it is best not to confuse software or people, so, in HTML4, anchor 
names *specified* in upper case are safest.

-- 
Etan Wexler <mailto:ewexler@stickdog.com>

Received on Sunday, 26 May 2002 04:38:25 UTC