W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Scoped style sheets.

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 14 Jul 2008 16:23:36 -0700
Message-ID: <487BDFF8.6010705@terrainformatica.com>
To: David Hyatt <hyatt@apple.com>
CC: Lachlan Hunt <lachlan.hunt@lachy.id.au>, www-style <www-style@w3.org>, Ian Hickson <ian@hixie.ch>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT