W3C home > Mailing lists > Public > public-html@w3.org > March 2012

Re: <style scoped> and the cascade

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 07 Mar 2012 16:52:46 -0500
Message-ID: <4F57D8AE.70900@mit.edu>
To: public-html@w3.org
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

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:30 UTC