Re: Scoped style sheets.

David Hyatt wrote:
> On Jul 14, 2008, at 5:50 PM, Andrew Fedoniouk wrote:
>
>>
>> One more thing about <style scoped />.
>>
>> What would be a specificity of CSS rules in scoped style sheet?
>> Question is in markup:
>>
>> <html>
>> <style>
>>  body #content p { color:red; }
>> <body>
>>  <div #content>
>>    <style scoped>
>>        p { color:green; }
>>    </style>
>>    <p>what would be the color of this text?</p>
>>  </div>
>> </body>
>> </html>
>>
>> It appears as <style scoped> should always be more specific than 
>> rules in just a <style>.
>> Yes/no?
>
> My own opinion is that each scope should constitute a separate author 
> cascade level.  This is how scoped stylesheets work in XBL.  So yes I 
> agree with you and think the spec needs to be amended.
We've met problem with that.

Say you have some component:

<div class="calendar">
   <style scoped src="calendar.css" />
   <table class="month-view">...</table>
</div>

with the styling:

---- calendar.css ------------
       td.week-name { color: ...; }     
       td.today { border: ...; }     
------------------------------

Intention is to give the user (of our component) ability to tune up
this styling a bit for his/her environment so to override some styles.
E.g. user is willing to change td.today rendering.

In style sets that we use there is an inheritance mechanism for that -
you can inherit authors set from another one and change styles there.

But in scoped html resided sets.... To be short: it should be something 
like important attribute:

<style scoped > - scoped styles first and page styles after.
<style scoped important > - page styles first and scoped styles after.

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Monday, 14 July 2008 23:24:29 UTC