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

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).

> > 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>
    <implementation>
      ({
        get nearestViewportElement() {
          var bb = this.baseBinding;
          if (bb && bb.nearestViewportElement) {
            return bb.nearestViewportElement;
          }
          // normal nearestViewportElement implementation here
        }
      })
    </implementation>
  </binding>

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

Thanks,

Cameron

-- 
Cameron McCormack, http://mcc.id.au/
 xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

Received on Thursday, 15 February 2007 01:21:47 UTC