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

Re: [cssom] Element size/positioning information

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 12 Apr 2011 17:34:20 -0700
Message-ID: <BANLkTinJRJqpgBdGgm3kd06_QcSQoUsv0Q@mail.gmail.com>
To: robert@ocallahan.org
Cc: Simon Fraser <smfr@me.com>, www-style list <www-style@w3.org>
On Tue, Apr 12, 2011 at 10:57 AM, Robert O'Callahan
<robert@ocallahan.org> wrote:
> For mouse event coordinates, you probably want another method
> element.transformPoint(relativeTo, x, y) returning a simple x,y Point
> object, transforming from a point relative to the element's first CSS box's
> content-box to a point relative to relativeTo's first CSS box's content-box.

I like this as well.  It solves one interesting use-case, where you
have a container which is broken across columns or pages, a child
element, and a child abspos that you want to position relative to the
other child.  The other APIs I've suggested don't really work for this
case - with this, you could do:

child.transformPoint(container, 0, 0);

Received on Wednesday, 13 April 2011 01:06:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:45 UTC