fix: Implement additional logic in DOMString::set_best_representation_of_the_floating_point_number in order to correct some failing tests related to -0 values. (#32272)

This commit is contained in:
shanehandley 2024-05-13 18:07:48 +10:00 committed by GitHub
parent 3d4fd0e550
commit 8eeb888010
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 67 additions and 74 deletions

View file

@ -2189,7 +2189,13 @@ impl HTMLInputElement {
datetime.format("%Y-%m-%dT%H:%M:%S%.3f").to_string(),
))
},
InputType::Number | InputType::Range => Ok(DOMString::from(value.to_string())),
InputType::Number | InputType::Range => {
let mut value = DOMString::from(value.to_string());
value.set_best_representation_of_the_floating_point_number();
Ok(value)
},
// this won't be called from other input types
_ => unreachable!(),
}