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

Re: Syntax of CSS Rules in HTML style attribute

From: fantasai <fantasai.lists@inkedblade.net>
Date: Tue, 22 Jan 2008 19:35:52 -0500
Message-ID: <47968BE8.3000408@inkedblade.net>
To: paul.duffin@volantis.com
CC: www-style@w3.org

Paul Duffin wrote:
> 
> All,
> 
> I have some comments and questions regarding the Working Draft
> http://www.w3.org/TR/2002/WD-css-style-attr-20020515. I have looked at 
> the W3C member pages for any updates to it but cannot find any, possibly 
> because I just don't know where to look. So if these have already been 
> covered then please could you refer me to the resolution.
> 
> 2) There appears to be an ambiguity in the grammar between the 
> inline-ruleset and the stylesheet productions as they can both match the 
> following string ":hover {color:red}" but depending on which one does 
> the effect will be different. i.e. if inline-ruleset matches then it 
> only applies to the current element but if stylesheet matches then it 
> applies to the current and all nested elements.
>
> As I see it there are two ways around this. The first is to require that
> an inline-ruleset always has to start with a declarations-block (possibly
> empty), followed by any optional pseudo attributes, or another at-rule
> is added, say @scoped {stylesheet} to contain the scoped stylesheet. 

On a related note, while I think the cascading behavior specced for
inline-ruleset makes sense, the draft doesn't seem to consider the cascading
behavior of complete 'stylesheet' constructs. Whatever is defined here
should apply also to HTML's scoped <style> elements.

I can see several ways to spin scoped styles:

   a) Append the rules after everything else (including ancestor scoped styles).
   b) Append the rules after everything else, but add the 'style' selector's
     specificity. (But how would this interact with ancestor scoped styles?)
   c) Replace all author-level rules with the scoped styles (but allow
     inheritance through the element).
   d) Replace all author-level rules with the scoped styles and break the
     inheritance chain.

If several of these behaviors are desired, it might make sense to define some
syntax for switching among them -- in which case an @scope construct would
make a lot of sense.

IIRC Daniel Glazman had some ideas on ways this could work. I'd also expect
Ian Hickson, as editor of HTML5, would some opinions on how he expects
<style scoped> to work.

I'm personally skeptical that b) makes sense in the complete stylesheet case.

~fantasai
Received on Wednesday, 23 January 2008 00:36:03 GMT

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