W3C home > Mailing lists > Public > www-style@w3.org > March 2007

[css3-fonts] should 'inherit' on shorthand apply to unspecifiable subproperties? [css3-syntax] [css3-cascade] [css3-values]

From: L. David Baron <dbaron@dbaron.org>
Date: Sat, 31 Mar 2007 10:30:30 -0700
To: www-style@w3.org
Message-ID: <20070331173030.GA23227@ridley.dbaron.org>
The 'font' shorthand in css3-fonts resets two properties,
'font-size-adjust' and 'font-stretch' to their initial values even
though they cannot be specified using the shorthand.  It says [1]:
  # All font-related properties are first reset to their initial
  # values, including those listed in the preceding paragraph plus
  # 'font-stretch' and 'font-size-adjust'. Then, those properties
  # that are given explicit values in the 'font' shorthand are set
  # to those values. For a definition of allowed and initial values,
  # see the previously defined properties. For reasons of backwards
  # compatibility, it is not possible to set 'font-stretch' and
  # 'font-size-adjust' to other than their initial values using the
  # 'font' shorthand property; instead, set the individual
  # properties.
This paragraph comes straight from CSS2 [2], but both of the
properties in question were dropped in CSS2.1.

What happens to these unspecifiable properties when the shorthand is
given the 'inherit' value?  Do they get their initial values or do
they get 'inherit'?  I tend to think they should get 'inherit'.

But a literal reading of the spec suggests that it isn't even
formally defined what happens when a shorthand property is set to
'inherit'.  This should be considered an issue in one of the other
drafts that defines the 'inherit' value, css3-syntax [3],
css3-values [4], or css3-cascade [5].  I think something needs to
specify that 'inherit' on a shorthand property either:
 * sets to 'inherit' all the properties that are considered
   specified by specifying the shorthand (my preference), or
 * sets to 'inherit' all the properties for which values can be
   given in the shorthand.
The same issue applies to 'initial'.  It probably even applies to
CSS2.1.

(I tend to think this is a more general issue.  In Mozilla we have
the problem in two places, since we've implemented background-origin
and background-clip from css3-background as -moz-background-origin
and -moz-background-clip [6], but we haven't implemented the
extensions to the background shorthand yet [7].  And I think there
may be some other places where we've created shorthands that can't
specify all the properties they reset.)

-David

[1] http://www.w3.org/TR/2002/WD-css3-fonts-20020802/#font-shorthand
[2] http://www.w3.org/TR/1998/REC-CSS2-19980512/fonts.html#font-shorthand
[3] http://www.w3.org/TR/2003/WD-css3-syntax-20030813/#initial
[4] http://www.w3.org/TR/2006/WD-css3-values-20060919/#keywords
[5] http://www.w3.org/TR/2005/WD-css3-cascade-20051215/#inheritance
[6] http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-background-clip
    http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-background-origin
[7] http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-background

-- 
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

Received on Saturday, 31 March 2007 17:30:40 GMT

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