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 22:10:28 -0500
Message-ID: <4F582324.4010907@mit.edu>
To: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
CC: public-html@w3.org
On 3/7/12 7:58 PM, Leif Halvard Silli wrote:
> The last<style scope>  is illegal.

To author, yes.  The UA processing model needs to be defined anyway.

> Shouldn't a<style scope>  that occurs somewhere else, should be without
> effect?

That's not what the spec says right now.

>>    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?
>
> It gives the impression that it is very important to make use of
> '!important', in order to make use of<style scoped>  ...

That was just a typo.  There should be an entry between (2) and (3) 
above, which is normal styles from "b".

> Which makes me wonder: What's the problem<style scope>  is supposed to
> solve? Isn't the purpose to *override* the effect of the cascade?

No.  For example, I would think that inline style on a node should 
override <style scoped>.

> Examples: Imagine we have<foo-root>  element as direct child of<body>.
> And imagine that we have a global<style>  in the<head>  with the
> following rule:
>
>     body foo-root {background:red}
>
> Simultaneously, inside a<style scoped>  inside the<foo-root>, we have
> this rule:
>
>     foo-root{background:lime}
>
> Problem: In this case the global style would win.

Not with my proposal.  That's the whole point of my proposal!

-Boris
Received on Thursday, 8 March 2012 03:10:59 GMT

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