Hmm, I didn't know CSS allowed escaping characters. This works on
firefox:
#tom.cat { selects id="tom" class="cat" }
#tom\.cat { selects id="tom.cat" }
Anyway, i find that confusing. Add the fact that things like ▒☃╋☎★☄☂
are valid IDs/class names, put some dots in the middle, and then
you've got a huge mess. Except that it's fun :D
- ricardo
On Oct 17, 4:54 pm, Dave Methvin <[EMAIL PROTECTED]> wrote:
> > 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">