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

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 UTC