Repository navigation
Description
WebKittens
No response
Title of the proposal
Allow ‘use’ to reference an external document's root element by omitting the fragment
URL to the spec
URL to the spec's repository
Issue Tracker URL
Explainer URL
TAG Design Review URL
No response
Mozilla standards-positions issue URL
mozilla/standards-positions#1204
WebKit Bugzilla URL
Radar URL
rdar://148973201
Description
In this feature, we are streamlining the SVG use element by loosening referencing requirements. Currently, authors need to explicitly reference fragments within the SVG document. If no fragment id is given use will not be able to resolve the target and nothing will be rendered/referred.
For example: a element referencing an external file with fragment identifier will look like:
<svg>
<use xlink:href="myshape.svg#icon"></use>
</svg>
In this example, #icon is the fragment identifier pointing to an element with id="icon" within myshape.svg.
and without fragment identifier it will look like:
<svg>
<use xlink:href="myshape.svg"></use>
</svg>
With this feature, omitting fragments or just giving the external svg file name will automatically reference the root element, eliminating the need for authors to alter the referenced document just to assign an ID to the root. This enhancement simplifies this manual editing process and improves efficiency.
Activity
[-][SVG 2.0] Allow use to reference entire files[/-][+][SVG 2.0] Allow `use` to reference entire files[/+]annevk commentedon Apr 15, 2025
I'm a bit surprised we'd further enhance the
useelement given what a security problem it has been to date. I suppose this is a relatively harmless change, but for an element whose fetch integration isn't even properly defined it seems like the wrong order of tackling issues.karlcow commentedon Apr 15, 2025
goldenboy777 commentedon Apr 15, 2025
@annevk Thanks for your reply!
I acknowledge the security concerns associated with the
useelement. However, the requested change does not exacerbate these issues in any manner. It simply aims to align the specification (https://svgwg.org/svg2-draft/struct.html#UseElement) with the existing browser code. As you already pointed out from a security standpoint, this particular change is harmless.Regarding priorities, while addressing security concerns with the element is crucial, this should not render the current item irrelevant. It is important in its own context, and dealing with security concerns is a separate issue that we should continue to focus on separately.
Also, there is a significant ask for this feature from the developers/web authors as can be seen from the chromium issue: https://issues.chromium.org/issues/40362369
I have still raised a TAG issue on this matter for the TAG to re-review this specification
w3ctag/design-reviews#1081
Hopefully, they will address any additional security concerns.
goldenboy777 commentedon Apr 15, 2025