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

Re: Whitespace, punctuation and :first-letter

From: Simon Montagu <smontagu@smontagu.org>
Date: Thu, 07 Oct 2010 11:08:39 +0200
Message-ID: <4CAD8E17.2070007@smontagu.org>
To: Simon Fraser <smfr@me.com>
Cc: www-style list <www-style@w3.org>
On 10/06/2010 02:32 AM, Simon Fraser wrote:
> I'm trying to fix some WebKit issues around :first-letter. The
> spec<http://www.w3.org/TR/CSS2/selector.html#first-letter> is not clear
> about how punctuation and whitespace interact, and there does not seem
> to be interop in this area. For example, with the following content:
>
> <style type="text/css">
> div:first-letter { color: green; }
> </style>
>
> <div>( T)est</div>
>
> In Safari, the ( and T are green.
> In Opera, the ( is green.
> In Firefox, nothing is green.

There are actually two separate issues in the testcase, and the spec is 
unclear about both of them.

1) Is intervening whitespace ignored when including preceding and 
following punctuation with the first-letter?
2) Is a non-alphanumeric character considered to be a first-letter?

For the second issue, I implemented in Firefox the clarification I 
suggested in 
http://lists.w3.org/Archives/Public/www-style/2008Jun/0362.html:

|':first-letter' applies if the first letter is a letter or a digit
|(i.e. characters defined in Unicode in the "uppercase" (Lu),
|"lowercase" (Ll), "titlecase" (Lt) and "other" (Lo) letter classes and
|the "decimal digit" (Nd), "letter" (Nl) and "other" (No) number
|classes).

At the time, I was in two minds about the first issue. Quoting myself again:

 >This is tricky because in a case like:
 >
 > <p>" This is a quotation "</p>
 >
 > it seems reasonable for :first-letter to apply to '" T', but in a
 > case like
 >
 > <p>"*" is an asterisk</p>
 >
 > it doesn't seem so reasonable for :first-letter to apply to '"*" i'.

At the time I thought that there was not much of a use case for the 
first form, but in the light of Ambrose Li's message I believe I was 
wrong. I will file a bug to change Firefox's behaviour.
Received on Thursday, 7 October 2010 09:09:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:32 GMT