Bug 237968 - SVG external sprite always re-downloaded over network when DOM reconstructed
Summary: SVG external sprite always re-downloaded over network when DOM reconstructed
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: Safari 14
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-16 09:51 PDT by James Ross
Modified: 2023-03-26 06:09 PDT (History)
6 users (show)

See Also:


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 Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Ross 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
Comment 1 Radar WebKit Bug Importer 2022-03-22 08:48:48 PDT
<rdar://problem/90638004>
Comment 2 Smoley 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?
Comment 3 James Ross 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.
Comment 4 Ahmad Saleem 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!
Comment 5 Ahmad Saleem 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