Re: [css3-values][css3-images] element() function

On 8/31/10 12:25 PM, Tab Atkins Jr. wrote:
> While all the uses right now are element-as-image, this also finally
> offers the possibility of selectors on the RHS of properties.  At the
> moment -moz-element() only accept id selectors, but one could imagine
> it accepting an arbitrary selector and just grabbing the first matched
> element

This is actually significanty more complex to implement, withou being 
deathly slow; id selectors are nice and simple because browsers already 
have a hashtable they maintain mapping IDs to elements and can notify 
interested parties when the mapping for a given id changes.  For an 
arbitrary selector you somehow have to make sure you change what element 
is matched when the DOM mutates.  This can get pretty complicated.

> one use in particular that I'm interested in is being able to specify an
> arbitrary element as the "positioning root" for an abspos element.

This seems like a use case that could be restricted to selecting only on 
ID for now without much loss of functionality.  That said, using 
element(#some-id) for this might not be too bad.  You'd have to specify 
what happens if that element is not in the DOM or is in a display:none 
subtree, of course.  And this obviously breaks incremental layout where 
absolutely positioned boxes are involved, because you have to lay out 
the referenced element before you lay out the abs pos boxes, right?

> I believe it is safe to add this to V&U right now.  Given that we
> already have one implementation, and Webkit offers a similar ability
> as well, it should be quite safe to add on the verge of Last Call.  If
> necessary, we could add it as At Risk.

I don't see how -webkit-canvas is much similar...


Received on Tuesday, 31 August 2010 16:39:00 UTC