mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibWeb: Port HTMLButtonElement interface from DeprecatedString to String
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 01:53:23 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/57d8b0ec73 Pull-request: https://github.com/SerenityOS/serenity/pull/20926 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/trflynn89 ✅
@@ -57,18 +57,18 @@ void HTMLButtonElement::initialize(JS::Realm& realm)
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLButtonElementPrototype>(realm, "HTMLButtonElement"));
|
||||
}
|
||||
|
||||
DeprecatedString HTMLButtonElement::type() const
|
||||
StringView HTMLButtonElement::type() const
|
||||
{
|
||||
auto value = deprecated_attribute(HTML::AttributeNames::type);
|
||||
|
||||
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \
|
||||
if (value.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return #keyword;
|
||||
return #keyword##sv;
|
||||
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
|
||||
|
||||
// The missing value default and invalid value default are the Submit Button state.
|
||||
return "submit";
|
||||
return "submit"sv;
|
||||
}
|
||||
|
||||
HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
|
||||
@@ -85,7 +85,7 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
|
||||
return HTMLButtonElement::TypeAttributeState::Submit;
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> HTMLButtonElement::set_type(DeprecatedString const& type)
|
||||
WebIDL::ExceptionOr<void> HTMLButtonElement::set_type(String const& type)
|
||||
{
|
||||
return set_attribute(HTML::AttributeNames::type, type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user