W3C home > Mailing lists > Public > www-style@w3.org > October 2003

Re: [css3-cascade] Proposed property: rule( sSelector );

From: Chris Moschini <cmoschini@myrealbox.com>
Date: Thu, 23 Oct 2003 10:08:42 -0400
To: www-style@w3.org
Message-ID: <1066918122.b5d125a0cmoschini@myrealbox.com>

Boris Zbarsky [bzbarsky@MIT.EDU] wrote:
> Erk. The specificity flag is a property of rules. Your suggestion
> would make the specificity of a rule as applied to the object depend on
> the object.

But I think expanding the Specificity flag could still work. Fitting with the
existing approach, encountering an @rule() could be handled by adding a second
instance of the rule requested with a different specificity flag and the caller's
selector.

To be concrete:

div.section { color: red; }
p.subsection { @rule( "div.section" ); color: blue; }

Now, a UA might parse this as though there were 3 rules:

div.section { color: red; }   /* specFlag = 5011 */
p.subsection { color: red; }  /* specFlag = 4011 */
p.subsection { color: blue; } /* specFlag = 5011 */

And continue into the DOM with these. Other than the expanded flag, this works
with existing code.

In the case of single property @rule()'s, the extra rule would copy just the one
property, that is:

li.info { color: green; border: 1px solid blue; }
li.error { color: red; border: @rule( "li.info" ); }

The UA might treat this as:

li.info { color: green; border: 1px solid blue; } /* specFlag = 5011 */
li.error { border: 1px solid blue; }              /* specFlag = 4011 */
li.error { color: red; }                          /* specFlag = 5011 */

-Chris "SoopahMan" Moschini
http://hiveminds.info/
http://soopahman.com/
Received on Thursday, 23 October 2003 10:08:46 GMT

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