- From: L. David Baron <dbaron@dbaron.org>
- Date: Tue, 17 Nov 2015 07:51:27 -0800
- To: www-style@w3.org
- Message-ID: <20151117155127.GA1611@pescadero.dbaron.org>
https://drafts.csswg.org/css-cascade/#shorthand says: In other cases, a property might be a reset-only sub-property of the shorthand: Like other sub-properties, it is reset to its initial value by the shorthand when unspecified, but the shorthand might not include syntax to set the sub-property to any of its other values. For example, the border shorthand resets border-image to its initial value of none, but has no syntax to set it to anything else. [CSS3BG] If a shorthand is specified as one of the CSS-wide keywords [CSS3VAL], it sets all of its sub-properties to that keyword, including any that are reset-only sub-properties. (Note that these keywords cannot be combined with other values in a single declaration, not even in a shorthand.) This principle -- that the CSS-wide keywords always affect all subproperties of a shorthand -- has, I believe, been well-known to members of the working group for a long time. However, it hasn't been clear to some implementors based on the prose elsewhere that actually defines these properties. I was led to this issue based on the discussion starting in https://bugzilla.mozilla.org/show_bug.cgi?id=1176792#c33 , which is about implementing the grid-{column,row}-gap properties, which https://drafts.csswg.org/css-grid/#grid-shorthand defines as being reset by the grid shorthand but not otherwise settable by them: The grid property is a shorthand that sets all of the explicit grid properties (grid-template-rows, grid-template-columns, and grid-template-areas), all the implicit grid properties (grid-auto-rows, grid-auto-columns, and grid-auto-flow), and the gutter properties (grid-column-gap and grid-row-gap) in a single declaration. If <βgrid-auto-rowsβ> value is omitted, it is set to the value specified for grid-auto-columns. Other omitted values are set to their initial values. Mats though that this meant 'grid: inherit' would need to set these properties to their initial values, rather than to 'inherit', partly because he wasn't aware of the text from css-cascade that I quoted above. When I pointed out that this concept was present elsewhere, Mats pointed out a testcase that shows that Chrome gets this wrong for 'border' resetting 'border-image', and appears to do what Mats thought the spec wanted him to do for 'grid': https://bug1176792.bmoattachments.org/attachment.cgi?id=8688433 I believe the Gecko rendering here is correct (multiple sets of green corners, since border-image is inherited) and the Chromium rendering is not (one set of green corners, and a black border inside). I think this points to lack of clarity in the spec wording, given that the definition I quote above in css-cascade is not findable from the definitions of these reset-only sub-properties. I think that the prose defining these reset-only sub-properties in css-grid, css-border, etc., should: 1. link to the definition of the term "reset-only sub-property" in css-cascade 2. either (a) be more deferential to that definition about what it means (and not state that the properties are reset to initial values) or (b) explicitly mention that CSS-wide keywords are applied rather than resetting those subproperties to their initial values (as all other values of the shorthand do). Or, to put it another way, spec prose should not state that most values reset the subproperty to its initial value without also stating that the css-wide keywords do otherwise. -David -- π L. David Baron http://dbaron.org/ π π’ Mozilla https://www.mozilla.org/ π Before I built a wall I'd ask to know What I was walling in or walling out, And to whom I was like to give offense. - Robert Frost, Mending Wall (1914)
Received on Tuesday, 17 November 2015 15:52:01 UTC