I believe the CSSOM spec should be amended to include top/left/bottom/right in the list of properties that return used value when display is not "none".
Currently, IE, FF, and Opera return the "used value" for top/left/bottom/right when "display" is not "none". Webkit returns the "computed value".
There is an open bug for this in Webkit to do the same as the other browsers: https://bugs.webkit.org/show_bug.cgi?id=29084 . One source of hesitation (and rightfully so) is that the spec currently says this is the correct behavior.
There are also open bugs for this in popular JS libraries: http://bugs.jquery.com/ticket/10639 http://yuilibrary.com/projects/yui3/ticket/2529799
Having the used value returned is a very useful operation. It's why JS libs are asking for it and a majority of browsers are doing it this way. It'd be great if the spec matched this reality.
Please see this thread on www-style for more information: http://lists.w3.org/Archives/Public/www-style/2012Mar/0350.html
We began having a discussion on the webkit bug tracker about whether or not "auto" is considered a used value or not, which is important for the definition of "resolved value" and important for helping webkit match the intent of the W3C here: https://bugs.webkit.org/show_bug.cgi?id=29084
> Opera 11.6: Passes all tests as written
> FF13: Converts "auto" to pixels so fails when expecting "auto".
> IE9/IE10: incorrectly accounts for padding so fails on the padding tests.
> Webkit: doesn't convert to pixels so fails when expecting pixels.
> Now, if we really wanted to go all the way with this, I personally believe that the FF behavior is most useful, and most accurately fits the idea of returning used value (that is, converting "auto" to actual pixels, even if not specified").
> However, to achieve the most consistency is to expect "auto", as you have written here.
Yeah, I'm not sure what the correct "expected" behavior is. Intuitively FF or Opera seem to do well but given that IE and Opera both return "auto" for unspecified values, returning "auto" here seems like a good idea.
We need some tests for vertical writing mode and RTL pages.
> According to http://www.w3.org/TR/CSS2/cascade.html#used-value, " The used value is the result of taking the computed value and resolving any remaining dependencies into an absolute value." and then subsequently "A used value is in principle the value used for rendering,"
> Is "auto" an absolute value or the value used for rendering? I don't personally believe so.
> Is "auto" a useful value to return? I personally don't believe so.
> Is "auto" consistent with MOST of the other browsers? yes.
> What I really care about here is that the percentage stuff gets fixed. Perhaps we can save any decision about "auto" for another ticket?
Glenn, I just wanted to document your response from www-style here: http://lists.w3.org/Archives/Public/www-style/2012Jul/0284.html
(In reply to comment #2)
> Glenn, I just wanted to document your response from www-style here:
See also http://lists.w3.org/Archives/Public/www-style/2012Jul/0288.html