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

On Mon, Jun 24, 2013 at 1:31 PM, Rune Lillesveen <rune@opera.com> 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%".
>

Here's the problem. You specify "center" in the style sheet. Not "initial"
and not "0% 0%". Consequently, the returned value should be "center". The
purpose of the CSSStyleRule.style is:
 style of type CSSStyleDeclaration<http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration>,
readonly The *declaration-block*<http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#q8>
of
this rule set.

And the declaration block you specified in your first example was:

{ background-position: center; background: blue; }


> 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?
>
>
Again, in the second example, the value of CSSStyleRule.style should denote
the specified declaration block:

{ background-position: initial }

and not a normalized form of the value associated with initial (like '0%
0%').



>
>   On Mon, Jun 24, 2013 at 9:17 PM, Rune Lillesveen <rune@opera.com> wrote:
>
>> When you serialize properties which have been set to its initial value by
>> a shorthand, and the UA supports the 'initial' keyword, should the
>> serialization use the 'initial' keyword or the actual initial value?
>>
>> Example:
>>
>> <style>
>>   p {
>>     background-position: center;
>>     background: blue;
>>   }
>> </style>
>> <script>
>>   alert(document.styleSheets[0].cssRules[0].style.backgroundPosition);
>> </script>
>>
>> Output "0% 0%" or "initial"?
>>
>>
>> Also, is an explicit use of 'initial' different?:
>>
>> <style>
>>   p {
>>     background-position: initial;
>>   }
>> </style>
>> <script>
>>   alert(document.styleSheets[0].cssRules[0].style.backgroundPosition);
>> </script>
>>
>> Output "0% 0%" or "initial"?
>>
>
>

Received on Monday, 24 June 2013 19:44:50 UTC