W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [cssom] Interaction of getComputedStyle.width/height and box-sizing

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 29 Mar 2013 10:03:32 -0700
Message-ID: <CAAWBYDDW5iV2Z6=7THgDkoVS+wDXSCMbV6uq5aaaHS3pBEJecA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style list <www-style@w3.org>
On Fri, Mar 29, 2013 at 9:25 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Per the current CSSOM spec, getComputedStyle.width/height return the used
> value.
> It's not clear to me exactly which of the various values box-sizing affects,
> since http://dev.w3.org/csswg/css-ui/#box-sizing is far too vague to
> actually _say_ what it does.  But it seems pretty clear that the used value
> would be affected, if things are at all sane,
> Which means that given this markup:
>   <div style="border: 10px solid; width: 100px; box-sizing: border-box">
> the used width will be 80px.

Oh, no, not at all.  You still want to return the used value *of the
'width' property*.  'box-sizing' changes how the 'width' property is
interpreted when figuring out the width of the content box, but it
doesn't actually change the value of the 'width' property itself.

> However Presto and WebKit report "100px" from getComputedStyle.  Gecko
> currently reports "80px" but we consider that a bug
> (https://bugzilla.mozilla.org/show_bug.cgi?id=520992 ).  IE9 seems to report
> "80px" as well....
> I _think_ we want to define this in the spec such that doing:
>   foo.style.width = getComputedStyle(foo).width;
> is a no-op, which means returning "100px" above, for what it's worth.


Received on Friday, 29 March 2013 17:04:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:27 UTC