mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-29 07:48:47 +00:00
LibWeb: Fix “step base” computation for HTMLInputElement
This change fixes a bug in our implementation of the “step base” algorithm at https://html.spec.whatwg.org/#concept-input-min-zero. We were using the “value” IDL/DOM attribute in a particular step, where the spec instead actually requires using the “value” content attribute.
This commit is contained in:
parent
9ca25eed7f
commit
13f9670f20
Notes:
github-actions[bot]
2025-03-06 14:01:24 +00:00
Author: https://github.com/sideshowbarker
Commit: 13f9670f20
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3806
Reviewed-by: https://github.com/trflynn89 ✅
4 changed files with 11 additions and 6 deletions
|
@ -2422,10 +2422,10 @@ double HTMLInputElement::step_base() const
|
|||
|
||||
// 2. If the element has a value content attribute, and the result of applying the algorithm to convert a string to a number to the value of
|
||||
// the value content attribute is not an error, then return that result.
|
||||
// AD-HOC: https://github.com/whatwg/html/issues/11097 Skipping this step seems to be necessary in order to get the
|
||||
// behavior that's actually expected — and necessary in order get the tests to pass (they otherwise fail).
|
||||
// if (auto value = convert_string_to_number(this->value()); value.has_value())
|
||||
// return *value;
|
||||
if (auto value = get_attribute(HTML::AttributeNames::value); value.has_value()) {
|
||||
if (auto value_as_number = convert_string_to_number(value.value()); value_as_number.has_value())
|
||||
return value_as_number.value();
|
||||
}
|
||||
|
||||
// 3. If a default step base is defined for this element given its type attribute's state, then return it.
|
||||
if (type_state() == TypeAttributeState::Week) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue