Re: <style scoped> and the cascade

On 2012-03-08 01:58, Leif Halvard Silli wrote:
> Boris Zbarsky, Wed, 07 Mar 2012 16:52:46 -0500:
>> 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)
[Edit: Normal styles from "b"]
>>    3)  !important styles from "b"
>>    4)  !important styles from "a" and "c" (sorted by specificity)
>>    5)  !important global styles
>>
>> Thoughts?

Why is the priority of the !important rules reversed?  Why should an 
!important global rule override an !important scoped rule?

I would expect this to work:

<style>
p { color: red !important; }
</style>
<div>
   <style scoped>
   p { color: green !important; }
   </style>
   <p>This line should be green.</p>
</div>

This would require the weights to be determined like this:

1. user agent declarations
2. user normal declarations
3. author normal declarations:
    a) From global styles
    b) From scoped styles (ordered hierarchically)
4. author important declarations
    a) From global stylesheets
    b) From scoped stylesheets (ordered hierarchically)
5. user important declarations

> 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.  The purpose is only to prevent styles from leaking to elements 
outside of the specified scope.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Thursday, 8 March 2012 12:28:07 UTC