Closed sagudev closed 2 weeks ago
Will you do this @shanehandley?
I will take a look! Thank you.
I was wrong 🙇 . parse_floating_point_number
is probably correct, my mistake was using it when I should have used set_best_representation_of_the_floating_point_number
, which is the one we need to touch up 👍
This comment in the WPT tests repo clarified things for me: https://github.com/web-platform-tests/wpt/issues/44315#issuecomment-1918932774
the best represetation of the number n as a floating point number, referenced from the setter, that relies on the ECMAScript ToString, itself dictating that the number -0 is stringified to 0
We have a DOMString::set_best_representation_of_the_floating_point_number()
, It is not called from anywhere in the codebase currently, and it uses the plain rust conversion to_string()
without applying any logic in the spec. It looks like it was originally added with the <range>
logic, but fell out of use.
It seems the work required is:
set_best_representation_of_the_floating_point_number
to be more compliant with the ECMAScript ToString specparse_floating_point_number
for affected elements: <meter>
, <progress>
, <input type="number">
and <input type="range">
.For 1., there is a lot of overlap between the ECMAScript and HTML specs for parsing floats (with radix omitted) - so maybe we can pluck out the some key steps and mostly fall back to it?
Oh, you're right, I also completely missed best represetation of the number n as a floating point number
part.
ECMAScript parsing of floats is implemented in SM (I think), so we would need conversions it might be better to just do some pre/post processing like it's done in parse_floating_point_number
on top of rust's to_string.
As noted in https://github.com/servo/servo/pull/32230#discussion_r1597356650
SPEC: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values