W3C home > Mailing lists > Public > public-html@w3.org > July 2007

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

From: Jim Jewett <jimjjewett@gmail.com>
Date: Tue, 31 Jul 2007 18:00:03 -0400
Message-ID: <fb6fbf560707311500k4d9da181ke22bc7de06245139@mail.gmail.com>
To: public-html@w3.org

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

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:47 UTC