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

On Wed, 14 Feb 2007, Cameron McCormack wrote:
> 
> Ian Hickson:
> > How about:
> > 
> >                get ownerSVGElement() {
> >                    var owner = this.boundElement.parentNode;
> >                    while (owner && !(owner instanceof SVGSVGElement))
> >                      owner = owner.parentNode;
> >                    return owner;
> >                }
> 
> This won't work if the svg:svg ancestor element is more than one 
> shadow scope away.

Ok:

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

But could you elaborate on why an author would ever actually want to do 
this though? I really don't understand what the use case is.


> I certainly can understand disallowing access to the shadow tree from 
> the bound element, as that does break the encapsulation.  Since the 
> binding can get out one level (by using this.boundElement), it should be 
> able to get out arbitrary levels to allow the functionality we are 
> requesting.

See above for a way around this.

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

Received on Wednesday, 14 February 2007 09:12:41 UTC