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

http://www.w3.org/TR/2007/CR-CSS21-20070719/syndata.html#characters
http://csswg.inkedblade.net/spec/css2.1#issue-19

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:
   http://lists.w3.org/Archives/Public/www-style/2007Nov/0169.html
Martin summarized the problem and its constraints best in
   http://lists.w3.org/Archives/Public/www-style/2007Nov/0188.html

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
converter):
   http://lists.w3.org/Archives/Public/www-style/2007Nov/0222.html
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
   http://lists.w3.org/Archives/Public/www-style/2007Nov/0219.html
   http://lists.w3.org/Archives/Public/www-style/2007Nov/0221.html
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.

Thanks~
~fantasai

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