Bug 290983
| Summary: | fws-supply.website: SVG <use> should work without specifying a fragment identifier | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Oliver Williams <oliverwilliams345> |
| Component: | SVG | Assignee: | Karl Dubost <karlcow> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | agafvv, ahmad.saleem792, chriskirknielsen+wkbugs, karlcow, sabouhallawa, webkit-bug-importer, zimmermann |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | All | ||
| URL: | http://wpt.live/svg/struct/reftests/use-external-svg-resource-no-fragment-id.html | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=191292 | ||
| Bug Depends on: | 65344 | ||
| Bug Blocks: | |||
Oliver Williams
Currently it is necessary to add an id to every SVG that a developer wants to use using <use>. According to the SVG 2 spec, this should no longer be required. Chromium version 137 is will remove this requirement. https://chromestatus.com/feature/5128141573718016
Rather than
<svg>
<use href="heart.svg#icon"></use>
</svg>
It should be possible to reference an entire SVG files directly:
<svg>
<use href="heart.svg"></use>
</svg>
In a time of HTTP/2, there is no longer a performance need to use sprite sheets. Keeping SVG as separate files is an easier approach. When using <use> for an icon system, needing to add an id to every SVG is laborious and error prone.
Relevant spec link is here https://svgwg.org/svg2-draft/struct.html#UseElement
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Karl Dubost
Thanks Oliver for the bug.
Probably things to explore around.
https://searchfox.org/wubkat/rev/85b73124f671d6d8fbe2b6dc730b98711b42326d/Source/WebCore/svg/SVGUseElement.cpp#447-482
Radar WebKit Bug Importer
<rdar://problem/148973201>
Karl Dubost
> The ‘use’ element can reference an entire SVG document by specifying an ‘href’ value without a fragment. Such references are taken to be referring to the root element of the referenced document.
— https://w3c.github.io/svgwg/svg2-draft/struct.html#UseElementHrefAttribute
Karl Dubost
https://wpt.fyi/results/svg/struct/reftests/use-external-svg-resource-no-fragment-id.html
Karl Dubost
Pull request: https://github.com/WebKit/WebKit/pull/64752
EWS
Committed 313550@main (9ba5d25ffcf1): <https://commits.webkit.org/313550@main>
Reviewed commits have been landed. Closing PR #64752 and removing active labels.