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

In http://lists.w3.org/Archives/Public/public-html/2007Jul/1261.html,

[ valid ID characters are ]
>>> Any character minus space characters.

[so you can have an id of "1" or "$^&"]

Sander Tekelenburg asked
>> How do existing (pre-HTML5) UAs handle this?

Anne van Kesteren wrote:
> Anyway, they handle it fine. In CSS you might
> have to escape certain characters because the IDENT
> production does not always allow them to occur literally.

That is an important enough limit that it should probably be included
in the good authoring advice, even if not in the actual grammar.
Perhaps something like:

Authors wishing to write robust applications are advised to use a more
restricted set of IDs.  While "1" and $^&" are technically valid
identifiers, they will trigger bugs in some tools.  Therefore, authors
SHOULD stick to ID characters from the ASCII digits [0-9] and one case
of ASCII letters (either [a-z] or [A-Z]), and SHOULD ensure that the
first character of each ID is a letter rather than a digit.

This probably applies to the name attribute as well.

-jJ

Received on Tuesday, 31 July 2007 22:00:06 UTC