[Webkit-unassigned] [Bug 258003] SVGSVGElement should support rem (probably other) units for width and height attributes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 12 22:20:26 PDT 2023


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

--- Comment #4 from Karl Dubost <karlcow at apple.com> ---
# For em values
Starting with 
data:text/html,<svg></svg>

> document.querySelector('svg').width.baseVal
< SVGLength {unitType: 2, value: 300, valueInSpecifiedUnits: 100, valueAsString: "100%", newValueSpecifiedUnits: function, …}
> document.querySelector('svg').setAttribute('width', '2em')
< undefined
> document.querySelector('svg').width.baseVal
< SVGLength {unitType: 3, value: 32, valueInSpecifiedUnits: 2, valueAsString: "2em", newValueSpecifiedUnits: function, …}


# For rem values
Restarting again with 
data:text/html,<svg></svg>

> document.querySelector('svg').width.baseVal
< SVGLength {unitType: 2, value: 300, valueInSpecifiedUnits: 100, valueAsString: "100%", newValueSpecifiedUnits: function, …}
> document.querySelector('svg').setAttribute('width', '2rem')
[Error] Error: Invalid value for <svg> attribute width="2rem"
        Console Evaluation (Console Evaluation 2:3)
< undefined
> document.querySelector('svg').width.baseVal
< SVGLength = $1

unitType: 2

value: 32

valueAsString: "100%"

valueInSpecifiedUnits: 100

SVGLength Prototype

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230613/1325bd82/attachment.htm>


More information about the webkit-unassigned mailing list