Re: Shadow DOM and SVG use elements

On Fri, Oct 23, 2015 at 12:42 PM, Travis Leithead <
travis.leithead@microsoft.com> wrote:

> Well, since SVG 'use' is mostly about replicating the composed tree
> anyway, it seems that is should probably render the composed tree--e.g.,
> this seems natural, because use would "replicate" the host element, which
> would then render it's shadow DOM.


The current implementation of <use> in Blink (and WebKit IIRC) is to
literally cloneNode the referenced content into a ShadowRoot off the <use>
element. Cloning the composed tree would change the way selectors in the
cloned tree matched by changing the shape and order of the tree. It also
means potentially cloning cousin elements of the used element which is
somewhat surprising. I'd be inclined to say all shadow roots inside the
used element are ignored, and all slots are inert.


> The interactivity behaviors associated with the shadow dom is an
> interesting question though.. today you are expected to attach event
> handlers to the ElementInstance (
> http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstance) which
> is the DOM representation of the "replicated" tree--I'm not sure what this
> would look like for Elements with an attached shadow.
>

The instance tree was removed in SVG2 I think, we certainly removed it from
Blink.

- E

Received on Friday, 23 October 2015 20:06:42 UTC