W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: [webcomponents] Adjusting offsetParent, offsetTop, offsetLeft properties in Shadow DOM

From: Elliott Sprehn <esprehn@gmail.com>
Date: Thu, 28 Mar 2013 12:55:19 -0400
Message-ID: <CAPJYB1hA7GaS+PBhq6w324oEzrZvZf7PcXhzxJua9+D3bGYKsw@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: public-webapps <public-webapps@w3.org>
On Wed, Mar 27, 2013 at 2:02 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> Scott Miles wrote:
>
> > This is a thorny problem, but my initial reaction is that you
> > threaded the needle appropriately. I don't see how we avoid some
> > lossiness in this situation.
>
> Note that if you're using offsetWith/Height/Top/Bottom you already lose,
> because they return integers.
>
> I think we should be doing what we can to discourage use of these broken
> APIs, for what it's worth, instead of worrying how we can extend their
> already-incorrect behavior to cover more cases "well".


That's fair, how do you feel about getPositionedAncestor(bool
includingTraversableShadows) ? This would solve the primary use cases for
offsetParent, and also mean jQuery wouldn't need to call getComputedStyle
all the way up the tree.

Walking the box tree is super fast in C++, and isPositioned is a bitfield
check. Doing this in JS with getComputedStyle is quite a lot more expensive
(allocate CSSComputedStyleDeclaration, parse the property name, return the
position value, compare the string).

- E
Received on Thursday, 28 March 2013 16:56:28 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 28 March 2013 16:56:29 UTC