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

Re: UA's implementation of ::selection

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 14 May 2010 22:36:15 -0400
Message-ID: <4BEE089F.4080400@mit.edu>
To: Fran├žois REMY <fremycompany_pub@yahoo.fr>
CC: www-style@w3.org
> Based on my tests, I would say Safari has the following behavior
> when it comes to ::selection :
>
>> The ::selection doesn't propagate at all in the DOM Tree.

You mean that ::selection is only applied to the immediate child 
textnodes of the element selected by the rest of the selector it's 
attached to (as in Gecko)?

>> The ::selection background is used to paint a layer which
> is between the Text Layer and the Background Layer. This
> layer has an intrinsec opacity. This opacity still apply when
> the background property set on ::selection specify already
> an alpha component (alpha values are multiplied). 'Ad
> nauseum', I would say it's a 0.75 opacity.
>
>> The selection layer has an honnor the traditional opacity
> (in the sense that it's opacity falls down to 0.375 when we
> set a 0.5 opacity on the parent element).

OK.  What about the behavior where it sometimes ignores the background 
styling altogether in cases that are equivalent to background styles it 
doesn't ignore?

>> Non textual elements are not concerned by the ::selection
> properties (the IMG selection overlay doesn't update).

That also sounds like Gecko; did you test table cell selections, or does 
Webkit not support those?

> In IE and Opera, the ::selection propagate through the DOM
> Tree (it means that any child of a div::selection inherits from
> the div::selection values).

What happens if there's a span child of the div which has 
span::selection specified?  Does one or the other win?  What if one 
specifies the color and the other the background?  Do both get used, or 
only one?

>> When a ::selection rulebapply

Which is when?  This is one of the things that needs to be defined.

> the background behind the text
> should be *exactly* the color described in the pseudo-element.

Cascaded how, if there are multiple pseudo-elements that might "apply"? 
  Or can that not happen?

> The browser selection extension rule should also apply on
> other type of selections like image overlay. They are left
> undefined, but they should use the color defined in the rule.

I'm not sure what that actually means.

>> If an element with ::selection has been found, we use
> the value that applies to that ancestror
>> If no element has been found, we use the normal behavior
> for the selection.

OK.  I assume you've looked at the issues with that approach that dbaron 
described in his mail?  If so, are there any particular reasons you've 
chosen to ignore those issues?  (I'm not saying this is a bad approach, 
just that it would be good to know why its known problems are ok).

You haven't defined where inheritance and currentColor computation 
happens from.

You haven't defined what should happen if the ::selection rule doesn't 
specify the background-color or the color or both.

-Boris
Received on Saturday, 15 May 2010 03:13:24 GMT

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