[whatwg] Magical alignment and moving anchor targets
Tab Atkins Jr.
jackalmage at gmail.com
Tue Dec 11 13:30:50 PST 2012
On Tue, Dec 11, 2012 at 10:45 AM, Matt Falkenhagen <falken at chromium.org> wrote:
> The spec seems unclear on whether a magically aligned element should
> follow its anchor when its anchor moves, e.g., by dynamic style changes or
> something like CSS animations.
> I think we want the element to follow the anchor. If someone does something
> anchor.style.top = ...
> They'd probably expect dialog to end up where anchor is, rather than where
> it was when show() was called.
Yes, it should follow. The only reason it wouldn't do that is it were
explained in terms of a one-shot adjustment of top/left. The fact
that it's done in terms of a (not yet specced) anchoring functionality
means that as long as the anchor is specified, the two elements should
have the correct relationship.
> Relatedly, it's not clear what happens if anchor is display: none or is not
> in the document when show() is called, but later has a rendered box and is
> in the document. And the reverse: if it is in the document when show() is
> called and later is removed.
The spec defines this - the magical alignment only happens while A and
B have rendered boxes. When the conditions don't apply, it's not
magically aligned. (The spec's recommendation for CSS is somewhat
badly designed for this - assume that it merely forces A to
"position:absolute", and while B doesn't have a box, A isn't anchored
and is interpreted as a normal abspos box.)
More information about the whatwg