Bug 219282

Summary: Style changes are not working inside SVG symbols
Product: WebKit Reporter: kari.pihkala
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, koivisto, rniwa, sabouhallawa, smoley, webkit-bug-importer, zimmermann
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 14   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
JavaScript Change Test Case
none
JavaScript Change Screenshot none

Description kari.pihkala 2020-11-25 00:49:26 PST
Created attachment 414859 [details]
JavaScript Change Test Case

JavaScript changes to element styles inside SVG <symbol> are not visible. JavaScript can change the element's style, but the changes are not visible on the page. Similarly, changes are not visible on the page when a <use> element references an element and the element's style is changed. So, it seems that changes are not updated in the SVG <use> element's shadow DOM.

The attached 'JavaScript Change Test Case' shows four circles. Pressing "Toggle Opacity" should change them to four smiling faces (three yellow and one blue). Only the blue smiling face is visible.

- The first two yellow faces are <use> elements referencing <symbol>.
- The third yellow face is a <use> element referencing <path>.
- The fourth blue face is just a path (no <use> or <symbol> elements involved), so it works as expected.

Note: hovering over the circles with a mouse will make the changes visible!

Chrome 87 and Firefox 83 show all four smiling faces as expected.

Tested on Safari Technology Preview Release 116 (Safari 14.1, WebKit 15611.1.5.3) and Safari 14.0.1.

There's a similar bug about CSS animations and this bug might be related to it: https://bugs.webkit.org/show_bug.cgi?id=173154
Comment 1 kari.pihkala 2020-11-25 00:50:10 PST
Created attachment 414860 [details]
JavaScript Change Screenshot
Comment 2 Smoley 2020-12-01 10:44:18 PST
Thanks for filing, I can reproduce this on Safari 13.1.3 as well as STP 116 with the provided test case.
Comment 3 Radar WebKit Bug Importer 2020-12-01 10:44:31 PST
<rdar://problem/71857275>
Comment 4 Ahmad Saleem 2022-08-12 08:56:32 PDT
I am able to reproduce this bug in Safari 15.6 and Safari Technical Preview 151 using attached test and upon toggle, it only change last circle to blue smily emoji or emoticon but all other three remain dots but in other browsers (Chrome Canary 106 and Firefox Nightly 105), they change to yellow emoticons or emoji. Thanks!