Re: [css3-selectors] ::selection

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 UTC