[Webkit-unassigned] [Bug 174977] [Shadow DOM] Use elements not resolved when SVG is nested in shadow root

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 4 02:13:12 PDT 2017


--- Comment #7 from Ryosuke Niwa <rniwa at webkit.org> ---
(In reply to Sebastian Müller from comment #6)
> While I understand that it may be difficult to deal with references that
> cross shadow-dom boundaries, I don't see how a "self-contained" SVG should
> leave anything to be discussed or even specced: If the use element is in the
> very same DOM subtree as the defs section, the relative # url should
> resolve, just like it does resolve properly if the svg is used in a data url
> as a image source.

We certainly need to define what that means. For example, what happens if there are multiple shadow trees in which there are two distinct #circle defined and referenced. From what you've described, it seems to indicate that each reference should be using the one defined in its own shadow tree. Unfortunately, this would not mesh well with the existing SVG 2.0 spec which states that use element's href uses a URL reference to reference the source element (see https://svgwg.org/svg2-draft/struct.html#UseElement) because fragment URLs do not have a mechanism to differentiate two IDs defined in each shadow tree. For my interpretation of what you're proposing to work, we need to invest a wholly different semantics for use element.

> Moving the self-contained (with no refernces to anything
> else outside the svg element) SVG image from the top-level DOM into a shadow
> dom should *not* break it completely.

That's a good first principle for making SVG work better with shadow trees. However, someone has to do the work of defining what it means to reference a SVG element inside a shadow tree in the same tree, from an inner shadow tree or from outside. Nothing is well defined in this regard.

> If you keep the implementation the way it is, this will be yet another
> reason for devs *not* to switch to shadow DOM. Because without being able to
> use vector graphics in shadow dom, devs will rather not use shadow dom than
> omit the graphics.

I've written https://perf.webkit.org/v3/ using shadow DOM and inline SVG everywhere (there is literally no image in that website) without use elements, and it has worked really well. I agree that SVG use element not working is a huge limitation of the shadow DOM API today but it would not totally undermine the usefulness of shadow DOM API in my opinion.

Anyway, I welcome your contribution to https://github.com/w3c/webcomponents/issues/179 so that we can define the behavior and implement it in WebKit.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170804/ed3c29d2/attachment-0001.html>

More information about the webkit-unassigned mailing list