Re: [CSSOM] resolved value for top/left/bottom/right doesn't match most browsers

Sure, thanks for correcting that. I was a bit oversimplifying the rules.
But that's part of the problem, isn't it! The rules are quite complex and
CSSOM attempts to clear up the confusion. In
http://dev.w3.org/csswg/cssom/#resolved-values, it says that
getComputedStyle should return the "resolved" value. It goes on to define
what "resolved value" means. Currently, it defines that
top/left/right/bottom should return "computed values". I was simply saying
that those should change to "used values", which is defined in
http://www.w3.org/TR/CSS21/cascade.html#used-value and
http://www.w3.org/TR/CSS21/cascade.html#computed-value

So,  Øyvind, with your input, it doesn't look like most browsers are
accurately behaving in accordance with the spec. That's to be expected,
seeing it's a fairly new spec, and still an Editor's Draft. No browser is
fully using "computed value" nor "used value".

With that said, I think we both agree (do we?) that the most USEFUL thing
here would be if the spec called out top/left/bottom/right to use "used
value" for several reasons:
1. It's what MOST browsers do in MOST cases (besides the glaring exceptions
you mentioned above).
2. it's called out as a bug whenever it doesn't return used value (1
browser bug, 2 JS library bugs).
3. Although I haven't checked exhaustively and I'm biased, I've seen no bug
reports expressing the need for computed value when used value is returned,
i.e. "hey, why doesn't getComputedStyle return "auto" or "10%" when I want
it to?"
4. Also, just from a development perspective, I can't imagine wanting
"auto" or a percentage returned from getComputedStyle, but that could just
be me and my bias again. Those values just aren't useful to me.

Thoughts?

On Wed, Mar 14, 2012 at 9:46 AM, Øyvind Stenhaug <oyvinds@opera.com> wrote:

> On Wed, 14 Mar 2012 13:45:02 +0100, Mike Sherov <mike.sherov@gmail.com>
> wrote:
>
>  Currently, IE, FF, and Opera return the "used value" for
>> top/left/bottom/right when "display" is not "none". Webkit returns the
>> "computed value".
>>
>
> Actually, that's not quite true. IE and Opera resolve percentages, but not
> 'auto', for instance (possibly this is closer to what "computed value" was
> supposed to mean in CSS 2.0 though I'm not sure). Even Firefox deviates
> from the used value in the cases of 'relative' and 'static' position.
>
> In particular, for <div style="position: relative; top: 50px; bottom:
> 10px"></div> all the above browsers return 10px for 'bottom'. Though if
> existing content doesn't rely on that, changing it would be nice.
>
> --
> Øyvind Stenhaug
> Core Norway, Opera Software ASA
>
>


-- 
Mike Sherov
Lead Developer
SNAP Interactive, Inc.
Ticker: STVI.OB

Received on Wednesday, 14 March 2012 22:13:52 UTC