W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: CSSOM clarifying used value for box model attributes, and specifically margins

From: Mike Sherov <mike.sherov@gmail.com>
Date: Sat, 3 Dec 2011 13:56:53 -0500
Message-ID: <CAD1Dv_KgHh0MyCJNzy73k7vh1PWGc0hQUOY2PSMGzZGf0D5eMA@mail.gmail.com>
To: www-style@w3.org
Actually, here it is, SORT OF:

http://www.w3.org/TR/css3-values/#stages-examples

This example shows that "auto" for "width" needs to be the used value,
which is >0px. But it does not specifically mention it for margin. I wonder
if that's a source of confusion, as firefox and Opera report the wrong
thing.

On Sat, Dec 3, 2011 at 11:59 AM, Mike Sherov <mike.sherov@gmail.com> wrote:

> I had some questions and comments with regards to the
> http://dev.w3.org/csswg/cssom/  editor's draft, specifically the section
> regarding resolved values and used values, and what getComputedStyle()
> should be reporting in regards to margin values. I contacted the editor
> listed on the draft, who pointed me here since she has resigned. I'm sure
> there are edge cases I am not considering, but I wanted to present the
> findings I have, and seek clarification on desired behavior.
>
> In any case, the problems can be demonstrated by looking at a few
> examples, which I lay out in the webkit bug tracker:
> https://bugs.webkit.org/show_bug.cgi?id=73334
>
> 1. Basically, there is some confusion around whether getComputedStyle()
> for box model attributes, and specifically margins, should always return a
> pixel value or not. Currently, webkit reports percentages if a percentage
> was specified, which can be seen by opening http://jsfiddle.net/u4F8m/9/ in
> a webkit browser. I'd argue that this should return a pixel value. Perhaps
> the CSSOM spec could be revised to clarify further what a used value means
> with regards to box model attributes, and in
> http://dev.w3.org/csswg/cssom/#resolved-values specifically mention pixel
> value. You can see the problem even further by opening this fiddle in O,
> FF, Webkit, IE9: http://jsfiddle.net/u4F8m/13/ they all report different
> values!
>
> 2. There is confusion amongst the browsers over what value to report in
> getComputedStyle() for margins when the value is set to "auto". Now, it
> *may* be that every browser except IE9 is correct in reporting 0px for
> margin-right when margin is set to auto, as it is here:
> http://jsfiddle.net/pyeNX/13/ . However, isn't the margin here, expressed
> as pixels, greater than 0? Now, I know everyone but IE9 reports 0px, but I
> believe that "used value" would dictate this margin to be the actual pixel
> value used, which seems like it's clearly greater than 0! That's how the
> inner div gets centered, right?
>
> I'm sure there are many considerations which I have not considered in
> presenting this information or I may be missing something, but I'd love
> some feedback on this.
>



-- 
Mike Sherov
Lead Developer
SNAP Interactive, Inc.
Ticker: STVI.OB
Tel: 516-647-5393
Received on Saturday, 3 December 2011 18:57:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT