W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: [CSS21] What does 'text-transform: capitalize' mean, exactly?

From: Maciej Stachowiak <mjs@apple.com>
Date: Sat, 25 Oct 2008 21:31:15 -0700
To: "L. David Baron" <dbaron@dbaron.org>
Cc: www-style@w3.org
Message-id: <5FFAA29C-314A-476A-A697-924324005021@apple.com>


On Oct 19, 2008, at 2:17 PM, L. David Baron wrote:

>
> I just wrote a not-very-complicated testcase for 'text-transform:
> capitalize':
> http://lists.w3.org/Archives/Public/www-archive/2008Oct/att-0018/text-transform-capitalize.html
>
> However, it shows up differently in Mozilla, WebKit, and Opera.
> For example, the text "(i.e.," turns into
>  "(i.e.," in Opera
>  "(I.e.," in Mozilla
>  "(I.E.," in WebKit
>
> Which is correct, and should this be defined in CSS 2.1 (perhaps in
> terms of Unicode character classes)?
>
> The spec currently says:
> # capitalize
> #     Puts the first character of each word in uppercase; other
> #     characters are unaffected.
> --http://www.w3.org/TR/CSS21/text.html#caps-prop

Since "capitalize" seems to in general apply initial caps, not title  
caps, I do not think specific abbreviations should be excepted from  
the general rule. I think WebKit roughly implements the rule:

- A sequence of letter or number ("alphanumeric", but in the unicode  
sense) characters preceded by a non-alphanumeric character or the  
start of the document.

My guess at the Mozilla and Opera rules is:

- Opera considers only whitespace to be a word separator, so  
punctuation either before or in the middle of a word will prevent the  
following letter from being capitalized.

- Mozilla appears to consider punctuation as allowed to continue but  
not start a word.

I would say Opera's rule is clearly wrong because it won't capitalize  
"dog" or (dog).

As between the Mozilla and WebKit rules, I would say from the  
perspective of an English-speaker each sometimes does what I expect  
and sometimes not. But the WebKit rule seems simpler.

Regards,
Maciej

P.S. in addition to the posted test case I tried testing the following:
(dog) .dog 23skidoo

Mozilla and WebKit agree on these, capitalizing both Ds but not the S.  
Opera does not capitalize either the Ds or the S.
Received on Sunday, 26 October 2008 04:31:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:15 GMT