Bug 237968

Summary: SVG external sprite always re-downloaded over network when DOM reconstructed
Product: WebKit Reporter: James Ross <james>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, beidson, sabouhallawa, smoley, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Mac (Intel)   
OS: macOS 12   
Attachments:
Description Flags
Zip of files in the referenced github repo none

James Ross
Reported 2022-03-16 09:51:06 PDT
Created attachment 454850 [details] Zip of files in the referenced github repo When manually constructing an SVG via JavaScript that uses an external stylesheet via `<use>`, no matter if the sprite is already rendered on the page, or if it's been downloaded before, it is always fetched over the network. This can lead to an excessive number of requests on pages that use JS to construct and deconstruct tooltips, menus, etc. Replication: - Clone https://github.com/Cherry/svg-external-sprite-redownloaded (also attached as zip to this ticket) - Run any server to serve this directory (npx serve for example) - Open resulting site, and watch network requests as both a PNG and SVG element are constructed and deconstructed every second Expected Results: `sprite.svg` to be only downloaded once Actual Results: `sprite.svg` is downloaded every second The replication was done using Safari 15.4 (17613.1.17.1.6) on MacOS 12.3. I did not test with iOS, but it's possible that's also impacted. I'm not sure if this is expected behaviour, but I did find a previous bug reporting similar things in the past: - https://www.smashingmagazine.com/2016/05/safari-svg-sprite-bug/ - https://bugs.webkit.org/show_bug.cgi?id=156368
Attachments
Zip of files in the referenced github repo (595.57 KB, application/x-zip-compressed)
2022-03-16 09:51 PDT, James Ross
no flags
Radar WebKit Bug Importer
Comment 1 2022-03-22 08:48:48 PDT
Smoley
Comment 2 2022-04-01 18:26:36 PDT
Thanks for filing, This does not reproduce for me on Safari Technology Preview Release 142 (Safari 15.4, WebKit 17614.1.5.16). Each icon is only fetched once. Are you still able to reproduce this on that build?
James Ross
Comment 3 2022-04-30 10:53:22 PDT
Thanks for the update, and my apologies for the delay in response on my end. I'm no longer able to replicate this on the latest Technology Preview release.
Ahmad Saleem
Comment 4 2023-03-26 06:09:45 PDT
The file confirmed that they are not able to reproduce this bug on STP as well. Marking this as "RESOLVED CONFIGURATION CHANGED". Thanks!
Ahmad Saleem
Comment 5 2023-03-26 06:09:57 PDT
(In reply to Ahmad Saleem from comment #4) > The file confirmed that they are not able to reproduce this bug on STP as > well. > > Marking this as "RESOLVED CONFIGURATION CHANGED". Thanks! *Filer / Reporter
Note You need to log in before you can comment on or make changes to this bug.