W3C home > Mailing lists > Public > www-style@w3.org > March 2012

Re: <style scoped> and the cascade

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 7 Mar 2012 13:18:08 -0800
Message-ID: <CAAWBYDBH=2PrUG8OZ+siK1rnrcA-exeKBuj8hzo+HW_dcbzBAQ@mail.gmail.com>
To: Dimitri Glazkov <dglazkov@chromium.org>
Cc: HTML WG <public-html@w3.org>, www-style list <www-style@w3.org>
On Wed, Mar 7, 2012 at 8:57 AM, Dimitri Glazkov <dglazkov@chromium.org> wrote:
> 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.

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.

~TJ
Received on Wednesday, 7 March 2012 21:18:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:51 GMT