Re: [cssom] Defining getComputedStyle

On 2/11/10 12:14 PM, Anne van Kesteren wrote:
>> For what it's worth, the Gecko behavior for "overflow" is to return a
>> value if the x and y values are equal and to treat it as a shorthand
>> otherwise.
>
> For overflow-x:visible; overflow-y:auto I get auto back as resolved
> value for overflow in Gecko.

Yes, because http://www.w3.org/TR/css3-box/#overflow says (if you scroll 
down enough):

   The computed values of ‘overflow-x’ and ‘overflow-y’ are the same
   as their specified values, except that some combinations with
   ‘visible’ are not possible: if one is specified as ‘visible’ and
   the other is ‘scroll’ or ‘auto’, then ‘visible’ is set to ‘auto’.

Perhaps I should have made it clearer that Gecko's decision on whether 
to treat as a shorthand or not depends on whether the _computed_ values 
of overflow-x and overflow-y are equal, not the specified values.

Note that this same draft has this verbiage:

   The computed value of ‘overflow’ is equal to the computed value of
   ‘overflow-x’ if ‘overflow-y’ is the same; otherwise it is the pair of
   computed values of ‘overflow-x’ and ‘overflow-y’.

So maybe that's the answer: have all newly shorthanded things specify 
what their computed value is.  Or something.

> What we could do is return values for all shorthand properties unless
> the individual properties make that impossible. E.g. border-color with
> four different colors does not fit in border. However this has the
> potential for breaking pages as well if they expect the empty string for
> some reason.

It could also be a bit of a pain to implement, and worse yet can cause 
behavior to change on existing pages for cases when subproperties are 
specified and then the computed shorthand value is queried if the 
shorthand starts setting more properties than before...

-Boris

Received on Thursday, 11 February 2010 17:26:59 UTC