After checking the W3C spec, it doesn't say much about what is and isn't
legal in a class in HTML.  It simply says that it's a CDATA.  But, the
examples in the spec doc do allow hyphens.  I'd be cautious about what
characters I use in a class, because CSS is stricter about what may be in
a selector than HTML itself is, and it would be a Good Thing to be able to
style by validation mask.

>From the CSS spec:
***
In CSS 2.1, identifiers  (including element names, classes, and IDs in
selectors) can contain only the characters [A-Za-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. Only
properties, values, units, pseudo-classes, pseudo-elements, and at-rules
may start with a hyphen (-); other identifiers (e.g. element names,
classes, or IDs) may not. 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".
***

> On 28/09/06, Brian <[EMAIL PROTECTED]> wrote:
>> I don't think that, technically, things like parens and colons are
>> permitted in a class.
>>
>
> I've never had problems with parenthesis and colons in the classname.
> They are just ignore by the css parser. Quick test:
>
> <style type="text/css">
> .bold {
>       font-weight: bold;
> }
> .underline {
>       text-decoration: underline;
> }
> </style>
> <span class="bold $(something:12) underline">Some text</span>
>
> Not sure how this will impact on the use of addClass and removeClass
> using jQuery though.
>
>> > As an alternative, you can still do it standards-compliant (or write
>> an
>> > XHTML module):
>> > <input class="$v(pattern:###-###-##)" />
>> >
>> > The plugin checks the class if there is no validate attribute.
>> >
>> > -- Jörn
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to