Bug 307677

Summary: removeAttribute for width/height on svg root element is trying to set an empty invalid string
Product: WebKit Reporter: Karl Dubost <karlcow>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, sabouhallawa, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: http://wpt.live/svg/coordinate-systems/outer-svg-intrinsic-size-002.html
See Also: https://bugs.webkit.org/show_bug.cgi?id=257758

Karl Dubost
Reported 2026-02-12 07:45:16 PST
About http://wpt.live/svg/coordinate-systems/outer-svg-intrinsic-size-002.html data:text/html,<!doctype html><title>svg</title><svg></svg> document.querySelector("svg").width.baseVal.value 300 document.querySelector("svg").height.baseVal.value 150 so far so good. data:text/html,<!doctype html><title>svg</title><svg width="500" height="500"></svg> document.querySelector("svg").width.baseVal.value 500 document.querySelector("svg").height.baseVal.value 500 Firefox/Chrome document.querySelector("svg").removeAttribute("width") undefined document.querySelector("svg").width.baseVal.value 300 Safari document.querySelector("svg").removeAttribute("width") Error: Invalid value for <svg> attribute width="" document.querySelector("svg").width.baseVal.value 500 setAttribute is working but removeAttribute defaults to trying to set the empty string (invalid) instead of reinitializing to the initial default value. to 300 for width and 150 for height
Attachments
Radar WebKit Bug Importer
Comment 1 2026-02-12 07:45:22 PST
Ahmad Saleem
Comment 2 2026-02-13 18:01:50 PST
https://github.com/WebKit/WebKit/pull/58695 <- Fixing `Error: Invalid value for <svg> attribute width=""` this issue - it wouldn't progress this WPT though.
Note You need to log in before you can comment on or make changes to this bug.