Re: [XBL] Accessing flattened tree parents of a shadow tree

On Thu, 15 Feb 2007, Cameron McCormack wrote:
> 
> Ian Hickson:
> > Assuming you mean the centering one, it was real, but it can be addressed 
> > much more easily using the mechanism I gave (center the group, then offset 
> > the group by half the bounding box).
> 
> That does require the function to modify the structure of the document 
> though, which I think is sub-optimal (other behaviour in the document 
> may rely on the structure).

Nah, just use an XBL binding. :-) That's exactly what XBL is for -- doing 
things that require modifiying the structure, without modifying the 
structure.

Although, if you're mutating the DOM anyway (which your example was doing, 
IIRC), I don't see why modifiying the structure is a problem. And in SVG, 
which is presentational by nature, modifying the DOM is not a problem like 
it is in (say) HTML, where you want to avoid poluting the DOM with 
semantic-free <div> elements.


> > > It seems reasonable to me.  The solution you gave doesn’t address 
> > > this because the containing bound element may not be under my 
> > > control (it was written by someone else) and thus may not implement 
> > > .nearestViewportElement itself.
> > 
> > So extend it, and implement "nearestViewportElement". XBL gives you 
> > the tools to do this -- you could even simply write a binding that 
> > applied to all elements that implemented this property.
> 
> Ah that would avoid the problem.  Something like:
> 
>   <binding element="*">
>     <template>
>       <inherited/>
>     </template>

No need for a template.

>     <implementation>
>       ({
>         get nearestViewportElement() {
>           var bb = this.baseBinding;
>           if (bb && bb.nearestViewportElement) {
>             return bb.nearestViewportElement;
>           }
>           // normal nearestViewportElement implementation here
>         }
>       })
>     </implementation>
>   </binding>

For example, yeah.


> Might be a bit dodgy in a CDF situation, having SVG interfaces 
> implemented on every element, but I guess that's unavoidable.

I thought the whole point was that you wanted this implemented on every 
non-SVG element. But in either case that doesn't seem like a big problem.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 15 February 2007 01:28:00 UTC