Hash

(No not that hash (:-)).)

There is rather a gulf between what CSS says about identifiers and what
HTML says:
<blockquote cite="http://www.w3.org/TR/REC-HTML401/types.html#h-6.2">
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores
("_"), colons (":"), and periods (".").
</blockquote>

cf.
HASH = #{name}
name = {nmchar}+
nmchar = [a-z0-9-]|{nonascii}|{escape}

This is especially bizarre given that:
IDENT = {ident}
ident = {nmstart}{nmchar}*
nmstart = [a-zA-Z]|{nonascii}|{escape}
nmchar = [a-z0-9-]|{nonascii}|{escape}

The HASH token is the ID token, and IDENT is used for class. It seems
bizarre in particular that even though SGML NAME tokens are more
restrictive than CDATA, class, which uses CDATA, has more restrictions
than does ID, which uses NAME.

Correct would be:

HASH = #{name}
name = {namestart}{namechar}+
namestart = [a-zA-Z]|{escape}
namechar = [a-z0-9-]|{escape}

In addition, I would like to see the following quotation changed:
<blockquote cite="http://www.w3.org/TR/REC-CSS2/syndata.html#q4">
In CSS2, identifiers (including element names, classes, and IDs in
selectors) can contain only the characters [A-Za-z0-9] and ISO 10646
characters 161 and higher, plus the hyphen (-); they cannot start with a
hyphen or a digit. They can also contain escaped characters and any ISO
10646 character as a numeric code (see next item). For instance, the
identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".
</blockquote>
to:
<blockquote>
In CSS2, identifiers (including element names and classes) MAY only
contain the characters [A-Za-z0-9] and ISO 10646 characters 161 and
higher, plus the hyphen (-); they MAY NOT start with a hyphen or a digit.
They MAY also contain escaped characters and any ISO 10646 character as a
numeric code (see next item). For instance, the identifier "B&W?" MAY be
written as "B\&W\?" or "B\26 W\3F". 

Name tokens (IDs) MAY only contain the characters [A-Za-z0-9], plus the
hyphen (-); they MAY NOT start with a hyphen or a digit. They MAY also
contain escaped characters and any ISO 10646 character as a numeric code.
However, authors should note that the SGML NAME token (as used for ID)
imposes additional restrictions - although #\000036 is valid CSS,
id="\000036" is not valid HTML (nor is id="&#54;").
</blockquote>

Note that this would also require a separate token (preferably two, one
for 3 digit, one for 6) for use by the hexcolor production.

These changes are necessary since at present #1 should be honoured (since
the criterion for ignoring a selector is that it cannot be parsed (i.e.,
if it is grammatically incorrect)).

Having proposed these changes, I also have a question - should invalid
(HTML) IDs result in the ruleset being ignored - can invalid IDs be
parsed?


=====
----------------------------------------------------------
From Matthew Brealey (http://members.tripod.co.uk/lawnet (for law)or http://members.tripod.co.uk/lawnet/WEBFRAME.HTM (for CSS))
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Received on Monday, 24 January 2000 06:38:36 UTC