- From: Divyansh Mangal via GitHub <noreply@w3.org>
- Date: Thu, 28 May 2026 12:52:12 +0000
- To: public-svg-issues@w3.org
goldenboy777 has just labeled an issue for https://github.com/w3c/svgwg as "Agenda+": == Behaviour of `:percent` spatial media fragment in SVG when no natural size is given for the external image == ## Problem The [SVG 2 linking spec](https://svgwg.org/svg2-draft/linking.html#LinksIntoSVG) defers spatial media fragments (`#xywh=..`.) to the [Media Fragments 1.0 spec](https://www.w3.org/TR/media-frags/). [Media Fragments §4.2.1](https://www.w3.org/TR/media-frags/#naming-space) allows the `xywh` value to be expressed in either `pixel:` (default) or `percent:` units, where percent units "are interpreted relative to the size of the resource." For raster media (image/video) the resource always has an intrinsic pixel size, so resolving percentages is well-defined. SVG is different: an `<svg>` document may have no intrinsic width/height (no width/height attributes and no viewBox), in which case it has no resolvable natural size until it is embedded in a context that supplies a concrete object size (CSS, img, object, etc.). Neither spec defines what `xywh=percent:..` should resolve against in that case. ## Implementations behaviour I checked the behaviour of `:pixel` and `:percent` spatial fragments with the presence/absence of width, height or viewbox in the external svg. Below are my observations: **1. Chrome:** Does not implement media fragments so external svg renders as is. **2. Firefox**: when width and height are explicitly given expected square is rendered. But when width and height is not given a [fallback ](https://searchfox.org/firefox-main/source/dom/svg/SVGFragmentIdentifier.cpp#182)of 300x150 seems to be used for the resolution. ## Possible resolutions 1. **Reject the fragment**, treat the percent fragment as invalid when no natural size is available, fall back to the default view. 2. **Resolve against a default 300×150** (the CSS replaced-element default). (Firefox current implementation) ## Rendering Results ### Firefox <img width="1410" height="1054" alt="Image" src="https://github.com/user-attachments/assets/4dc841d3-5311-40ad-9994-e22fa9f7daec" /> ### Chrome <img width="1667" height="1220" alt="Image" src="https://github.com/user-attachments/assets/fb28a0f1-93ab-4f94-8a03-9b8e93a9fd54" /> [spatial-media-fragments.html](https://github.com/user-attachments/files/28106222/spatial-media-fragments.html) See https://github.com/w3c/svgwg/issues/1113 -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 28 May 2026 12:52:13 UTC