Re: CSS3 Selectors question

Ian Hickson wrote:

> On Thu, 1 May 2003, Ernest Cline wrote:
> > [Ian, paraphrased:]
> >>    ::selection *
> >> ...is invalid because selections never contain elements
> >
> > Where does that restiction exist?
> 
> Hmm, that doesn't seem to have made it into the spec. The intention is
> that ::selection is the inner most pseudo-element at any point.
> 
> That has to be the case, otherwise nested elements' backgrounds, colours,
> and cursors would override the selection's, which is bad UI.

I can see the point, yet it also seems to limit expressivity.

For example, consider the following set of CSS rules:

  ::selection {outline: medium red solid}
  ::selection>* {outline: medium green dashed}

If ::selection could have children this would enable a user to 
determine if the selection boundary matched up with an element boundary 
even if it was not obvious in the nonselected document.

There are thus two questions:

1) Is there a way of establishing that ::selection has precedence?
The answer is yes, altho slightly more awkward.  If ::selection were 
established to have higher precedence than id's then the selector
  ::selection, ::selection *
would do what you want ::selection to do now.

2) Is there a compelling need for ::selection to have children?
The answer is I don't have one, since my quickly derived example above 
could have its purpose handled by other means, such as an alternative 
style sheet with the rule:
  * {outline: medium green dashed}
Still if the intention is that ::selection is to have no children, then 
that is something that should be added to the errata.

Received on Sunday, 4 May 2003 07:52:17 UTC