RE: Positioned Layout proposal

 

Tab Atkins Jr. wrote on Monday, October 18, 2010 12:32 PM
> Since I've worked at Chrome, one of the things I've heard 
> developers complain about a lot is the weakness of absolute 
> positioning.  For example, our app devs commonly want to 
> position tooltips relative to arbitrary elements in a 
> contenteditable area.
> 
> To fix this, I've written a personal draft of a new 
> Positioned Layout spec I'd like to see adopted by the group.  
> It's currently hosted on my blog: <http://www.xanthir.com/blog/b48H0>.
> 

"When specifying which edge an element positions itself relative to,
it's possible to create cycles, where following the chain of references
from one element eventually leads back to the same element. For example,
a cycle is created in the following code:

#one {
  position-root-top: element(#two) bottom;
  top: 0;
}

#two {
  position-root-top: element(#one) bottom;
  top: 0;
}

Both of the elements are attempting to position their top edge against
the other element's bottom edge. Obviously, these cannot both be
satisfied at the same time. [[Define how to resolve cycles. I'll
probably just say that an arbitrary but well-defined reference is broken
(reference edge set to the relevant 'self' edge?), but I want to hear
more from people who know more about constraint systems first.]]"

I don't know anything about constraint systems, but I would follow the
CSS principle that the last-specified item rules.

That is, #two would be positioned relative to #one, and the
position-root-top would be ignored for #one to prevent the cycle.

Hope this helps,
Charles Belov
SFMTA Webmaster

Received on Monday, 18 October 2010 20:03:07 UTC