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:

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

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


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

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:49 UTC