Re: [cssom][css3-values] Serialization of initial from shorthand

On Monday 2013-06-24 21:31 +0200, Rune Lillesveen wrote:
> On 06/24/2013 04:14 PM, Glenn Adams wrote:
> >In the first case, I would expect "center" returned, and in the
> >second, I would expect "initial" returned: because these are
> >specified values.
> 
> In the first case, the background shorthand will reset
> background-position to its initial value, I just added the "center"
> declaration to illustrate that. So I think that needs to be either
> "initial" or "0% 0%". For the second case, I agree that it should be
> "initial". What I'm less sure about is the text from
> css-backgrounds:
> 
> "Given a valid declaration, for each layer the shorthand first sets
> the corresponding layer of each of 'background-image',..., and
> 'background-attachment'to that property's initial value, ..."
> 
> Does it say "to that property's initial value" instead of "to
> 'initial'" because it's not aware of the 'initial' value from
> css-values?

I think it should actually *not* be the 'initial' value, given that
in general the 'initial' value can't be serialized as part of a
shorthand.  I'd rather stick to the model that:
 * if there's any 'inherit'/'initial' involved, serialization of a
   shorthand will fail unless all the subproperties are that same
   'inherit' or 'initial'
 * otherwise, the shorthand will attempt to serialize using
   appropriate rules, and omitting values that can be omitted.

(This is even worse for background layers, since it doesn't make
sense to make 'initial' be the value for a single layer when there
are multiple layers, since that layer then *still* couldn't be
serialized into valid CSS syntax if a different layer had a
different value.)

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Monday, 24 June 2013 20:59:02 UTC