Re: <style scoped> and the cascade

On 3/7/12 4:18 PM, Tab Atkins Jr. wrote:
> Hmm, true.  The problem is worsened by the fact that scoped
> stylesheets provide an "implicit prelude" that restricts their
> selectors without increasing specificity, so global selectors that are
> trying to target the same elements will often naturally be longer.
>
> I support Boris's change.

There's a similar question about the interaction between two scoped 
stylesheets scoped to nested elements, actually.  Consider this testcase:

  <div>
    <style id="a" scoped></style>
    <p>
      <style id="b" scoped></style>
    </p>
    <style id="c" scoped></style>
  </div>

For descendants of the <p>, I would think that the cascade order should be:

   1)  Global stylesheets
   2)  Styles from "a" and "c" (sorted by specificity, etc)
   3)  !important styles from "b"
   4)  !important styles from "a" and "c" (sorted by specificity)
   5)  !important global styles

Thoughts?

-Boris

Received on Wednesday, 7 March 2012 21:53:16 UTC