Re: Convention for tests proving initial values?

Grant, Melinda wrote:
>> For inheritable properties you may need to set
>>    html, body, div {
>>      foo: inherit;
>>    }
>> to test the initial value.
> 
> OK, you lost me here.  What do you mean by inheritable?  Elements for which
> 'Inherited' is 'no'?

Elements for which 'Inherited' is 'yes'.

> (If 'Inherited' is 'yes', I shouldn't need to specify 'inherit'...)
>
> But if you mean elements that don't inherit, and I'm trying to prove the
> initial value of foo on 'div', why would I want it to inherit from html?

The problem is, what if the UA stylesheet does something like

   body { text-indent: 0; }

and you want to test the initial value of 'text-indent'? You could check 
that a <div> is not indented, but you're not checking the initial value 
then, you're checking the UA's value on body (since text-indent 
inherits). By setting everything from the root element down to the div 
as 'inherit', then you are grabbing the value from above the root 
element, and since there's nothing there that forces the UA to look up 
the property's initial value.

The reason you don't need to do this for non-inherited properties is 
that we explicitly assume that the only declaration applied to <div> by 
the UA is 'display: block;'.
   http://www.w3.org/Style/CSS/Test/CSS2.1/current/
(So for testing the initial value of display, you'd actually need to use 
the 'inherit' trick even though it's a non-inherited property.)

~fantasai

Received on Thursday, 14 August 2008 19:09:38 UTC