Re: QSA, the problem with ":scope", and naming

On Thu, Oct 20, 2011 at 14:52, Jonas Sicking <jonas@sicking.cc> wrote:

> > <style scoped> should (I think) have three cases:
> >
> > 1. Selector without :scope - same as .find
> > 2. Selector with :scope - Same as #1, but also including the context
> node.
> > 3. Selector in @global - run the selector across the entire document,
> > filter the results to only be the context node and its descendants.
> >
> > (Some people disagree with me on this, and think that #1 and #2 should
> > be merged to always include the context node.  That's acceptable, but
> > I don't like it as much.)
> >
> > I think it's perfectly okay that these two APIs have different cases.
>
> I'm not sure I understand what you are proposing here. Are you saying that
>
> <div>
> <style scoped>
> :scope {
>  background: green;
> }
> </style>
> </div>
>
> should set the background of the <div> green? This does seem intuitive
> I agree, but it might also lead to strange behavior since the
> rendering of the <div> will change once the stylesheet is parsed. In
> other words, it's very easy to get flash-of-unstyled-content behavior.
>

Hixie's - again valid IMHO - counterargument for this was that, with the
above proposal:

    div { background-color-green }

would not color the scoping element, while the more specific (!)

    div:scope { background-color: green }

would. I.e., a more specific selector suddenly selecting MORE elements than
a not so specific one.


- Roland

Received on Thursday, 20 October 2011 08:10:00 UTC