Re: <style scoped> and the cascade

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:56 UTC