W3C home > Mailing lists > Public > www-style@w3.org > November 2007

Re: [css3-selectors] ::selection

From: Allan Sandfeld Jensen <kde@carewolf.com>
Date: Mon, 26 Nov 2007 21:34:23 +0100
To: www-style@w3.org
Message-Id: <200711262134.24300.kde@carewolf.com>

On Monday 26 November 2007 19:05, Anne van Kesteren wrote:
> The Selectors Level 3 specification should probably go into more detail on
> how boxes for ::selection are to be generated so that it's clear how it
> interacts with other styles, etc. That would also help if someone decides
> to support background-image for ::selection.
>
> WebKit and Gecko support it in such a way that it doesn't affect the
> selection color of child elements. So if you have:
>
>    p::selection { background:lime }
>
>    <p>FOO<span>BAR</span>BAZ</p>
>
> and someone selects "FOOBARBAZ" "BAR" will have the default selection
> color. I don't really care about how this is going to be done, but I'd
> like it to be defined.
>
> (It would probably be good if someone tackled ::first-letter and
>
> ::first-line too which have similar issues.)

I am surprised WebKit doesn't support that case, since KHTML does and I think 
we implemented ::selection after WebKit example.

Anyway we still have issues with ::selection since we just only inherit the 
first parent declaration of ::selection. This creates problems with multiple 
levels of ::selection, but this is the exact same bug all browsers have 
with ::first-letter and ::first-line.

    p::selection { background:lime }
    span::selection { font-width: bold }

    <p>FOO<span>BAR</span>BAZ</p>

FOO and BAZ will have lime background, BAR will only be bold. Unlike the above 
example where BAR would be lime. This behavior matches common implementations 
of ::first-letter and ::first-line.

The correct method of how to combine multiple ::first-letter or ::first-line 
declarations is very clear, still no one has implemented it, I would 
naturally assume ::selection follows a similar model.

`Allan
Received on Monday, 26 November 2007 20:34:39 GMT

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