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

Re: UA's implementation of ::selection

From: Brad Kemper <brad.kemper@gmail.com>
Date: Sat, 15 May 2010 12:44:09 -0700
Cc: François REMY <fremycompany_pub@yahoo.fr>, Boris Zbarsky <bzbarsky@MIT.EDU>, www-style@w3.org
Message-Id: <476D78A1-E37B-4BD1-A034-B857F8AAF676@gmail.com>
To: David Hyatt <hyatt@apple.com>

On May 15, 2010, at 9:48 AM, David Hyatt wrote:

> Selection would work much better if it was a property that was just part of the cascade and inherited by default, e.g.,
> 
> #mydiv {
>   selection: green;
> }

This would be a good, simple approach. It should take at least two values though (foreground and background color). It would work well if we wanted to limit the styling to just color (and not background-images, shadow, etc.).


> Or if we want to have more flexibility for extensibility, you could use some kind of identifier reference to point to an external rule:
> 
> @selection myselection {
>   background-color: green;
> }
> 
> #mydiv {
>   selection: myselection;
> }

Does that get us into the endless debates like we had when discussing @variable or @constant or @macro or whatever?

> Alternatively we could say ::selection is only queried against the root element, and then have the pseudo element itself take an argument identifier:
> 
> html::selection(myselection) {
>   background-color: green
> }|
> 
> #mydiv {
>   selection: myselection;
> }

I like that approach, especially if we want to expand beyond just the two color properties, and allow text-shadow, box-shadow (if it was one selection shape even when spanning multiple elements), outline, border, etc. 

If it was not per element at all, something similar might also seem to be more appropriate as a way to describe what iPhone selection is like, sitting in front of the whole page:

html::selection {
  -css4-background-color: blue multiply;
  border-left:1px solid bue;
  border-right:1px solid bue;
}




Received on Saturday, 15 May 2010 19:51:05 GMT

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