Bug 219282 - Style changes are not working inside SVG symbols
Summary: Style changes are not working inside SVG symbols
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari 14
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2020-11-25 00:49 PST by kari.pihkala
Modified: 2023-09-22 01:17 PDT (History)
9 users (show)

See Also:


Attachments
JavaScript Change Test Case (2.31 KB, image/svg+xml)
2020-11-25 00:49 PST, kari.pihkala
no flags Details
JavaScript Change Screenshot (33.09 KB, image/png)
2020-11-25 00:50 PST, kari.pihkala
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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!