[CSSWG] [CSS2.1] Case-sensitivity in CSS


Case-insensitivity in CSS is currently not precisely defined. The
meaning of "case-insensitive" is pretty obvious in ASCII, but it's
not so obvious in Unicode. Some characters map differently based
on the locale, some characters can't round-trip a case mapping
operation so you get different matches depending on whether you map
to lowercase, uppercase, or "case-fold" case, etc.

There was a recent discussion about this problem on www-style:
Martin summarized the problem and its constraints best in

There are two issues here:
   a) What the case mapping should be for CSS-defined identifiers such
      as property and keyword names.
   b) What the case mapping should be for user-defined identifiers such
      as counters and page names.

For the first issue, since CSS-defined identifiers only use characters
in the ASCII range anyway, ASCII case-insensitivity would be sufficient.
It would also prevent strings containing characters outside the ASCII
range from unexpectedly matching CSS keywords (which could cause
security problems).

For the second issue, we could adopt the Unicode case-folding algorithm,
which is at least well-defined. However a test shows that
implementations already treat counter names as case-sensitive. This is
interoperable across all four major CSS counters implementations:
Firefox, Opera, Safari, and PrinceXML (an HTML/XML + CSS -> PDF
Also because it's much more straightforward than case-insensitivity in
Unicode, it is more likely to be interoperable going forward. The
downside is that case-sensitive counters could be more confusing for
authors used to case-insensitive CSS.

The CSS Working Group proposes to adopt the following changes
which would
   a) define case-insensitivity of CSS-defined identifiers as ASCII
      case-insensitivity: i.e. a-z and A-Z match, but no other
      characters outside that range will ever map into that range.
   b) define counter names as case-sensitive in CSS2.1, which would
      also set case-sensitivity as the precedent for user-defined
      identifiers introduced in future specs

Unless there are objections that cause us to reconsider, we plan to
formally resolve this issue on 8 January 2008. Please send any comments
before then.


Received on Wednesday, 12 December 2007 20:45:03 UTC