> It's not useful to claim that the specs are faulty.  Until they change, dots
> in IDs are legal and valid.

Re-read Ricardo's answer. You are free to use dots in your ids if you
want. He is saying that by permitting a dot in an id string, the specs
allow a confusing ambiguity that has to be resolved somehow. The W3C
says this:

http://www.w3.org/TR/CSS21/selector.html
"A CSS ID selector contains a "#" immediately followed by the ID
value, which must be an identifier"

http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
In CSS, identifiers  (including element names, classes, and IDs in
selectors) can contain only the characters [a-z0-9] and ISO 10646
characters U+00A1 and higher, plus the hyphen (-) and the underscore
(_); they cannot start with a digit, or a hyphen followed by a digit.
Identifiers 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".

Notice that CSS allows you to escape characters that are not valid in
an identifier, such as the period. Similarly, as Ricardo points out,
jQuery allows you to resolve the problem:

$("tom.cat")  selects <div id="tom" class="cat">

$("tom\\.cat") selects <div id="tom.cat">



Reply via email to