mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
LibWeb: Ensure value sanitization algorithm trims whitespace if needed
Previously, the value sanitization algorithm would not trim whitespace for inputs of type URL or email, if they didn't also contain any newlines.
This commit is contained in:
parent
87056ee0d2
commit
c4b82318f4
Notes:
github-actions[bot]
2024-09-10 15:14:19 +00:00
Author: https://github.com/tcl3
Commit: c4b82318f4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1360
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 2 additions and 0 deletions
|
@ -1361,6 +1361,7 @@ String HTMLInputElement::value_sanitization_algorithm(String const& value) const
|
|||
}
|
||||
return MUST(String::from_utf8(builder.string_view().trim(Infra::ASCII_WHITESPACE)));
|
||||
}
|
||||
return MUST(value.trim(Infra::ASCII_WHITESPACE));
|
||||
} else if (type_state() == HTMLInputElement::TypeAttributeState::Email) {
|
||||
// https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email):value-sanitization-algorithm
|
||||
// FIXME: handle the `multiple` attribute
|
||||
|
@ -1373,6 +1374,7 @@ String HTMLInputElement::value_sanitization_algorithm(String const& value) const
|
|||
}
|
||||
return MUST(String::from_utf8(builder.string_view().trim(Infra::ASCII_WHITESPACE)));
|
||||
}
|
||||
return MUST(value.trim(Infra::ASCII_WHITESPACE));
|
||||
} else if (type_state() == HTMLInputElement::TypeAttributeState::Number) {
|
||||
// https://html.spec.whatwg.org/multipage/input.html#number-state-(type=number):value-sanitization-algorithm
|
||||
// If the value of the element is not a valid floating-point number, then set it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue