W3C home > Mailing lists > Public > www-style@w3.org > October 2009

Re: [CSSOM] offsetWidth, offsetLeft issues

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 16 Oct 2009 22:42:00 -0700
Message-ID: <c9e12660910162242k23268754l3cc14f9c990a88aa@mail.gmail.com>
To: robert@ocallahan.org
Cc: Ojan Vafai <ojan@chromium.org>, Erik Arvidsson <arv@chromium.org>, www-style@w3.org
On Fri, Oct 16, 2009 at 8:03 PM, Robert O'Callahan <robert@ocallahan.org> wrote:
> On Sat, Oct 17, 2009 at 1:10 PM, Ojan Vafai <ojan@chromium.org> wrote:
>>
>> On Wed, Oct 14, 2009 at 1:17 PM, Robert O'Callahan <robert@ocallahan.org>
>> wrote:
>>>
>>> On Thu, Oct 15, 2009 at 8:50 AM, Erik Arvidsson <arv@chromium.org> wrote:
>>>>
>>>> The width and height of getBoundingClientRect is always the same as
>>>>
>>>> offsetWidth and offsetHeight.
>>>
>>> I don't really care about this one. offsetWidth and offsetHeight are
>>> really bad legacy features.
>>
>> No argument there. But we should at least make them as sane as possible,
>> no? In the case of tables with captions, it makes more sense to include the
>> caption. Given that IE already does this, it seems likely to maximize
>> compatibility, or at least not make it worse.
>
> It seems to me that right now the CSSOM spec is a little vague on this
> matter. On the offset* properties it talks about "the border-edge of element
> A", when it really needs to specify a particular CSS box (or union of CSS
> boxes).
>
> I don't really mind if the spec changes so that offsetWidth and offsetHeight
> match the size of getBoundingClientRect. That would make them include the
> table caption. However, I can't promise that we'll change Gecko to match. It
> seems almost any change to our offset* implementation produces regressions
> in Web content, perhaps because there is browser-sniffing code that makes
> assumptions about what we currently do. I'd rather just give up on offset*
> and forget about them and concentrate on making
> getClientRects/getBoundingClientRect useful and interoperable across
> browsers.
>

In contrast to offsetLeft and offsetTop, ffsetWidth and offsetHeight
more consistently reliable. They are useful because they return
dimensions that include border. The properties are widely supported,
widely used and programs will continue to use them and continue to
expect that they behave as they do today.

As with any major change, I recommend a google code search for
research. This is a very easy step to take.

http://www.google.com/codesearch?q=offsetWidth+lang%3Ajavascript&hl=en&btnG=Search+Code

A browser changing these properties return *content* width would
probably break millions of web pages and applications.

In CSS2, A CAPTION has its own content, padding, margin, and border areas.

The CAPTION's margin collapses with its TABLE's margin, and its border
that is adjacent to its TABLE collapses with its table border.

IE treats css differently with CAPTION.

Garrett
Received on Saturday, 17 October 2009 05:42:33 GMT

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