fix(fill): do not validate the value of date, time, color and range inputs

Merged
YU
1mo ago
+6-64

fill() sets input.value for date, time, color and range inputs and threw "Malformed value" unless the browser read it back unchanged. Browsers serialize some valid values in canonical form, e.g. datetime-local 2020-03-02T06:20:00 becomes 2020-03-02T06:20, so valid values were rejected.

This removes the check instead of special-casing each type: whatever the browser keeps is the value, as when a user picks it in the UI. Invalid values are no longer reported; the browser sanitizes them (dates and times to "", color to #000000, range to the default) and fill() succeeds. The "should throw on incorrect …" tests are removed accordingly.

Alternative to #43383, which keeps the check and accepts datetime-local re-serialization.

Fixes: https://github.com/microsoft/playwright/issues/43370

Closes: https://github.com/microsoft/playwright/pull/43383