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

On Wed, 7 Feb 2007, Cameron McCormack wrote:
> 
> With respect to authors implementing the standard SVG interfaces in a 
> binding[1], we’ve found that it is not possible to have an 
> implementation of particular interfaces (such as SVGElement and 
> SVGLocatable) because bindings cannot traverse the flattened tree from 
> the xbl:template element to the bound element.  This functionality was 
> available in sXBL (the xblParentNode property of the NodeXBL interface).
> 
> For example, the SVGElement interface has a property ownerSVGElement, 
> which simply returns the closest ancestor svg element. In this document:
> 
>   <svg xmlns="http://www.w3.org/2000/svg">
>     <xbl xmlns="http://www.w3.org/ns/xbl">
>       <binding element="ex|container">
>         <template>
>           <content/>
>         </template>
>       </binding>
>       <binding element="ex|something">
>         <implementation>
>           ({
>               get ownerSVGElement() {
>                   // XXX what here?
>               }
>           })
>         </implementation>
>       </binding>
>     </xbl>
> 
>     <ex:container>
>       <ex:something/>
>     </ex:container>
>   </svg>

How about:

               get ownerSVGElement() {
                   var owner = this.boundElement.parentNode;
                   while (owner && !(owner instanceof SVGSVGElement))
                     owner = owner.parentNode;
                   return owner;
               }


> there is no way for the ownerSVGElement getter to traverse up the 
> flattened tree to find the svg element to return.

Why would it go up the flattened tree? SVG just says its the nearest 
parent 'svg' node. (Though it doesn't say what should happen if there 
isn't one.)


> The SVG WG requests that a feature that allows script to traverse up the 
> flattened tree be added.

Unfortunately, I've received exactly the opposite request -- namely to 
ensure data hiding and prevent navigation of the flattened tree -- so I 
wouldn't be able to address both requests. I have marked your request as 
being a potential formal objection.

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

Received on Tuesday, 13 February 2007 19:29:01 UTC