[CSS21] Clarification on Inheritance

Dear Style experts,

I sent an email [1] on the SVG Public Mailing List concerning problems 
that I have when implementing SVG, SMIL and CSS together. In this email, 
I proposed changes to the CSS 2.0 specification to clarify some aspects 
about inheritance.
I received one comment asking me to read the CSS 2.1 draft and post a 
message here if I still had comments. So, here it is. I have reviewed 
only sections 1 and 6 of CSS 2.1 and I believe some changes should be 
made to improve the clarity of the specification with respect to 
inheritance.

A) Meaning of 'inherited'
I understand that when a property is defined as 'inherited: no', this 
means that to inherit, you explicitely need to specify the value 
'inherit' for that property. Is that correct ?

If yes, 'inherited by default' would probably be a better wording. I 
propose the following modifications:

In the explanation of the syntax for the definition of a property 
(http://www.w3.org/TR/CSS21/about.html#property-defs), it says:
'inherited: yes/no' means:
"whether the property is inherited".
I think it should say:
"whether the property, if not specified, is inherited".

In the definition of 'inherited' (http://www.w3.org/TR/CSS21/about.html#q10)
It says:
"This part indicates whether the value of the property is inherited from 
an ancestor element."
And I think it should rather say:
"This part indicates whether the value of the property is inherited from 
an ancestor element, when it is not specified on an element."

Maybe it would be good also to change the property's definition line 
'inherit: yes/no' to 'inherited by default: yes/no' ?
 
B) Meaning of 'initial'
In the definition of 'initial' 
(http://www.w3.org/TR/CSS21/about.html#initial-value), the specification 
says:
"If the property is inherited, this is the value that is given to the 
root element of the document tree."
I believe, it should add:
"If the property is not inherited, this is the value that is given to an 
element if the property is not specified."

C) Cascading and Inheritance
Let me rephrase section "6.1.1 Specified values" 
(http://www.w3.org/TR/CSS21/cascade.html#specified-value) to see if I 
understand correctly.

The cascade is the process to retrieve a possible value from either one 
of the three stylesheets or from presentational hints like the SVG or 
HTML presentation attributes. It may result in:
 a) no value
 b) a value 'inherit'
 c) another value
 
In case a), if the property's definition says 'inherited: no' or if the 
element is the root, the specified value is the initial value.
In case a) if it says 'inherited: yes', or in case b), the element's 
specified value is the parent's computed value. This is the inheritance 
mechanism.
In case c), the value resulting from the cascade is the specified value. 
No inheritance applied.

Is this correct ?

The CSS 2 specification said that you could inherit 'specified' value 
depending on the property's definition. Is this really changed?

If my understanding is correct, to improve the clarity, I would propose 
the following changes.

Changes to 6.1.1 "Specified value" 
(http://www.w3.org/TR/CSS21/cascade.html#specified-value):
"1. If the cascade results in a value, *and this value is not
'inherit',* use it.
2. Otherwise, if the property is inherited *(because the cascade 
resulted in the value 'inherit' or because the cascade resulted in no 
value and the property's definition specifies 'inherited: yes')* and the 
element is not the root of the document tree, use the computed value of 
the parent element.
3. Otherwise use the property's initial value. The initial value of each 
property is indicated in the property's definition."

The link from the word 'inherited' should be 
http://www.w3.org/TR/CSS21/about.html#q10 and not 
http://www.w3.org/TR/CSS21/cascade.html#inheritance.

Chantes to Section 6.1.2 "Computed values" 
(http://www.w3.org/TR/CSS21/cascade.html#computed-value):
Remove the following paragraph already captured in the changes above:
"When the specified value is not 'inherit', the computed value of a 
property is determined as specified by the Computed Value line in the 
definition of the property. See the section on inheritance for the 
definition of computed values when the specified value is 'inherit'."

Changes to section 6.2 "Inheritance" 
(http://www.w3.org/TR/CSS21/cascade.html#inheritance) says:
"Some values are inherited by the children of an element in the document 
tree, as described above. Each property defines whether it is inherited 
or not *, when the cascade results in no value*. When inheritance 
occurs, elements inherit computed values. The computed value from the 
parent element becomes both the specified value and the computed value 
on the child."

Changes to section 6.2.1 "The 'inherit' value" 
(http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit)

Remove the following sentence, since since with the above change, the 
value 'inherit' cannot be a specified value.
"Each property may also have a specified value of 'inherit', which means 
that, for a given element, the property takes the same computed value as 
the property for the element's parent."

Replace the sentence:
"The 'inherit' value can be used to strengthen inherited values, and it 
can also be used on properties that are not normally inherited."
By the following:
"The 'inherit' value is used on properties that are not inherited by 
default, i.e. when the cascade results in no value, to explicitely apply 
inheritance. For other properties, it can be used to emphasize that 
inheritance is applied."

Best regards,

Cyril Concolato

[1] http://lists.w3.org/Archives/Public/www-svg/2006Sep/0003.html

Received on Thursday, 7 September 2006 08:57:06 UTC