[Webkit-unassigned] [Bug 236719] New: ID encapsulation is broken with fragment identifiers in SVGs within a shadowRoot

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 16 10:46:10 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=236719

            Bug ID: 236719
           Summary: ID encapsulation is broken with fragment identifiers
                    in SVGs within a shadowRoot
           Product: WebKit
           Version: Safari 15
          Hardware: Mac (Intel)
                OS: macOS 11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: SVG
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: Elliot.nahman at gmail.com
                CC: sabouhallawa at apple.com, zimmermann at kde.org

SVGs can use fragment identifies to link various assets such as patterns, clipPaths, etc to SVG elements. When the SVG lives within a shadowRoot, the IDs of these assets should be encapsulated and just have to be unique within their respective shadow DOM.

However, I believe starting in Safari 15, this is no longer the case. Now if the same ID is used in multiple different shadow DOMs, all the references to the fragment point to the last instance put on the page. If that instance is removed from the page, then no fragment will be applied.


See https://codepen.io/nonmetalhail/pen/PoOOZaL for an example of the bug. 
In the example, you start off with two webcomponents, each with an SVG in their shadowRoots. Each SVG displays a pattern. On first render, the patterns are correct for each SVG. However, when the first SVG is re-rendered, it erroneously adopts the pattern of the second SVG. If the pattern from the second SVG is deleted (in the example the whole WC is removed), and the first re-rendered again, it is does not display any pattern even though its own pattern is still present in the its DOM.

-- 
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/20220216/82a5ff74/attachment-0001.htm>


More information about the webkit-unassigned mailing list