NEW 267560
[SVG] baseVal value of circle r attribute returns 0 and a console error while still drawing
https://bugs.webkit.org/show_bug.cgi?id=267560
Summary [SVG] baseVal value of circle r attribute returns 0 and a console error while...
Karl Dubost
Reported 2024-01-15 16:45:51 PST
Steps to reproduce 1. Copy in Safari URL bar this: data:text/html,<!doctype html><svg><circle r="100 "/></svg> (Notice the space at the end of the r attribute: "100 ".) 3. In the Web Inspector console, type: document.querySelector('circle').r.baseVal.value Results: * Web Inspector Console displays: Error: Invalid value for <circle> attribute r="100 " * document.querySelector('circle').r.baseVal.value returns 0 * document.querySelector('circle').r.animVal.value returns 0 * document.querySelector('circle').getAttribute('r') returns "100 " While Firefox and Chrome * No error message in the console * document.querySelector('circle').r.baseVal.value returns 100 * document.querySelector('circle').r.animVal.value returns 100 * document.querySelector('circle').getAttribute('r') returns "100 " Error message in WebKit is coming from https://searchfox.org/wubkat/rev/581e116dc6ce254811dbe2da9d1c1168762fc30c/Source/WebCore/svg/SVGElement.cpp#150-169 which has been called by length.setValueAsString(valueAsString).hasException() https://searchfox.org/wubkat/rev/581e116dc6ce254811dbe2da9d1c1168762fc30c/Source/WebCore/svg/SVGLengthValue.cpp#192-202 called by SVGLengthValue::setValueAsString(StringView string) https://searchfox.org/wubkat/rev/581e116dc6ce254811dbe2da9d1c1168762fc30c/Source/WebCore/svg/SVGLengthValue.cpp#324-342 There is a auto convertedNumber = parseNumber(buffer, SuffixSkippingPolicy::DontSkip); which seems not able to ignore spaces.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-01-15 16:46:03 PST
Karl Dubost
Comment 2 2024-01-15 16:51:31 PST
Probably related to Bug 192507
Ahmad Saleem
Comment 3 2024-01-15 16:54:35 PST
(In reply to Karl Dubost from comment #2) > Probably related to Bug 192507 Should we tackle following bug 261656 case by case and see how many these issue get fixed?
Karl Dubost
Comment 4 2024-01-15 17:34:35 PST
Oh I had forgotten about this. <3 Feel free to go ahead if you have a solution for one thing or all things.
Note You need to log in before you can comment on or make changes to this bug.