Skip to content

[SVG 2.0] Allow use to reference entire files #480

Open

Description

@goldenboy777

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

https://svgwg.org/svg2-draft/struct.html#UseElement

URL to the spec's repository

https://github.com/w3c/svgwg/blob/main/master/struct.html

Issue Tracker URL

https://issues.chromium.org/issues/40362369

Explainer URL

https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/SVG/allow-use-to-reference-entire-files.md

TAG Design Review URL

No response

Mozilla standards-positions issue URL

mozilla/standards-positions#1204

WebKit Bugzilla URL

https://bugs.webkit.org/show_bug.cgi?id=290983

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

  1. changed the title [-][SVG 2.0] Allow use to reference entire files[/-] [+][SVG 2.0] Allow `use` to reference entire files[/+] on Apr 15, 2025
  2. annevk commented on Apr 15, 2025

    @annevk
    Contributor

    I'm a bit surprised we'd further enhance the use element 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.

  3. karlcow commented on Apr 15, 2025

    @karlcow
  4. goldenboy777 commented on Apr 15, 2025

    @goldenboy777
    Author

    @annevk Thanks for your reply!
    I acknowledge the security concerns associated with the use element. 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.

  5. goldenboy777 commented on Apr 15, 2025

    @goldenboy777
    Author
  6. added
    venue: W3C SVG WG
    on Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: svgvenue: W3C SVG WG

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions