mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb/HTML: Implement and use "optional value"
Corresponds to f3444c23ff
Also import a test.
This commit is contained in:
committed by
Tim Ledbetter
parent
22cc36eeaa
commit
af17f38bbf
Notes:
github-actions[bot]
2025-07-08 16:10:58 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/af17f38bbf6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5353 Reviewed-by: https://github.com/tcl3 ✅
@@ -659,6 +659,18 @@ String HTMLInputElement::value() const
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Optional<String> HTMLInputElement::optional_value() const
|
||||
{
|
||||
switch (m_type) {
|
||||
// https://html.spec.whatwg.org/multipage/input.html#submit-button-state-(type=submit):concept-fe-optional-value
|
||||
case TypeAttributeState::SubmitButton:
|
||||
// The element's optional value is the value of the element's value attribute, if there is one; otherwise null.
|
||||
return get_attribute(AttributeNames::value);
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> HTMLInputElement::set_value(String const& value)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
Reference in New Issue
Block a user