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

Re: <style scoped> and the cascade

From: Dimitri Glazkov <dglazkov@chromium.org>
Date: Wed, 7 Mar 2012 08:57:22 -0800
Message-ID: <CADh5Ky0gNQfkRiLT4mz6qWW2E2TpWFL40WFGY9ki43BVpmmA7g@mail.gmail.com>
To: HTML WG <public-html@w3.org>
Cc: www-style list <www-style@w3.org>
On Tue, Mar 6, 2012 at 10:37 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> I've been looking into scoped stylesheets, and I'm not sure that the way the
> spec currently places them in the CSS cascade makes sense.  If the intent is
> for them to be used for styling a particular subtree, it seems like they
> should probably come later than global document sheets in the cascade;
> otherwise you can end up with global sheets accidentally overriding scoped
> styles, which makes it difficult to really use scoped styles effectively.

I've been playing with the experimental implementation in Chrome and I
already can say that I got stumped by this at least twice. You have to
really play with specificity to get the right results.

>
> Of course the counterargument could be made that the opposite behavior would
> disallow document-global sheets from "fixing up" problems from scoped
> styles.
>
> Perhaps the cascading order should be:
>
>  document normal rules
>  scoped normal rules
>  scoped !important rules
>  document !important rules
>
> ?
>
> ccing www-style, but this discussion should probably happen on the htmlwg
> list, since that's where scoped styles are defined...
>
> -Boris
>
Received on Wednesday, 7 March 2012 16:57:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:17:46 GMT