Intent to Ship: Support width and height as presentation attributes on nested <svg> elements

6,078 views
Skip to first unread message

Divyansh Mangal

unread,
Jun 11, 2025, 4:28:17 PM (13 days ago) Jun 11
to blink-dev

Contact emails

[email protected]

Explainer

None

Specification

https://svgwg.org/svg2-draft/geometry.html#Sizing

Summary

This feature supports applying width and height as presentation attributes on nested <svg> elements through both SVG markup and CSS. This dual approach provides even greater flexibility for developers, allowing them to manage and style SVG elements more efficiently within complex designs.

With this feature the below two html will now have the same output:

With CSS Properties for nested <svg> element:

<svg width="100px" height="100px">

  <svg style="width:50px;height:50px;">

    <circle cx="50px" cy="50px" r="40px" fill="green" />

  </svg>

</svg>

 

Without CSS Properties for nested <svg> element:

<svg width="100px" height="100px">

  <svg width="50px" height="50px">

    <circle cx="50px" cy="50px" r="40px" fill="green" />

  </svg>

</svg>

 

Blink component

Blink>SVG

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

None



Gecko: No signal (https://github.com/mozilla/standards-positions/issues/1243)
In Firefox, the width and height attributes cannot be applied on nested <svg> elements as styles

WebKit: Neutral  (https://github.com/WebKit/standards-positions/issues/509)
In Safari, the width and height attributes cannot be applied on nested <svg> elements as styles

Web developers: Positive 7 people have upvoted this in the chromium issue.

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

Existing Devtools capabilities already support this feature.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

WPTs in chromium:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/svg/styling/nested-svg-sizing.svg
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/svg/styling/nested-svg-sizing-with-use.svg



Flag name on about://flags

None

Finch feature name

WidthAndHeightAsPresentationAttributesOnNestedSvg

Rollout plan

Will ship enabled for all users

Requires code in //chrome?

False

Tracking bug

https://issues.chromium.org/issues/40409865

Estimated milestones

Shipping on desktop

139

Shipping on Android

139

Shipping on WebView

139

Shipping on iOS

139



Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5178789386256384?gate=5132029741760512

This intent message was generated by Chrome Platform Status

Domenic Denicola

unread,
Jun 13, 2025, 5:02:34 AM (12 days ago) Jun 13
to blink-dev, [email protected]
This intent feels a little risky, because, as WebKit points out in their standards-positions issue, there isn't really an adequate specification for how SVG layout works in cases like this. For example, how it will behave with non-px values. (The WPTs you link only include px values.)

Since SVG2 is a mostly-unmaintained specification, and this feature has at least some web developer demand, I don't want to require that you specify everything perfectly here. But I'd like to see at least some of:
  • Discussion with other implementers in the standards positions issues. (You've started these discussions, but I'd like to give them more time to settle.)
  • More exhaustive web platform test coverage, including values like `min-content`, `calc-size()`, `20em`, `50%`, `auto`, `stretch`, `50vh`, etc.
  • Some discussion in the CSSWG about how they would like to see this specified in the future.
  • A pull request to update the relevant parts of the SVG2 spec with some vague language about the expected results; it doesn't have to be rigorous, but it should be at least enough for other implementers to understand how to follow our behavior.
Not all of these are required, and if I had to pick a single one that was most important, it would be expanded web platform test coverage.

Divyansh Mangal

unread,
Jun 13, 2025, 7:48:41 PM (11 days ago) Jun 13
to Domenic Denicola, blink-dev

Hi Dominic, thanks for your suggestions in the I2S
As suggested, our current action involves writing WPTs to better understand the expected behavior of missing CSS values. This will enable us to present more informed and concrete results to the CSSWG and other platforms, fostering clearer discussions and more consistent implementations.

We will update the I2S once that step that done.

Divyansh Mangal

unread,
Jun 24, 2025, 9:02:29 AM (19 hours ago) Jun 24
to blink-dev, Divyansh Mangal, [email protected]
Hi Dominic, we have incorporated few of the action items that you suggested. Specially the priority ones:

I have created a WPT PR to increase the coverage of different values of width and height CSS properties
https://github.com/web-platform-tests/wpt/pull/53186.

I have also started a CSS issue https://github.com/w3c/csswg-drafts/issues/12376
where we are clarifying and getting opinions on what should happen with the undefined values in the SVG specification.

Yoav Weiss (@Shopify)

unread,
Jun 24, 2025, 11:21:45 AM (17 hours ago) Jun 24
to Divyansh Mangal, Vladimir Levin, Chris Harrelson, blink-dev, [email protected]
Thanks for working on these!!

+Vladimir Levin +Chris Harrelson - what would it take to add these to the CSSWG agenda? (and maybe get eyes on the WPT review)

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/eceef370-1e35-4aa8-87db-724bcfdb4b0dn%40chromium.org.
Reply all
Reply to author
Forward
0 new messages