1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibWeb: Port HTMLButtonElement interface from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-09-03 15:29:34 +12:00 committed by Tim Flynn
parent 2ab7129595
commit 57d8b0ec73
3 changed files with 7 additions and 7 deletions

View file

@ -57,18 +57,18 @@ void HTMLButtonElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLButtonElementPrototype>(realm, "HTMLButtonElement")); 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); auto value = deprecated_attribute(HTML::AttributeNames::type);
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \ #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \
if (value.equals_ignoring_ascii_case(#keyword##sv)) \ if (value.equals_ignoring_ascii_case(#keyword##sv)) \
return #keyword; return #keyword##sv;
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE #undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
// The missing value default and invalid value default are the Submit Button state. // The missing value default and invalid value default are the Submit Button state.
return "submit"; return "submit"sv;
} }
HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
@ -85,7 +85,7 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
return HTMLButtonElement::TypeAttributeState::Submit; 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); return set_attribute(HTML::AttributeNames::type, type);
} }

View file

@ -34,9 +34,9 @@ public:
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE #undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
}; };
DeprecatedString type() const; StringView type() const;
TypeAttributeState type_state() const; TypeAttributeState type_state() const;
WebIDL::ExceptionOr<void> set_type(DeprecatedString const&); WebIDL::ExceptionOr<void> set_type(String const&);
// ^EventTarget // ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-button-element // https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-button-element

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlbuttonelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlbuttonelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLButtonElement : HTMLElement { interface HTMLButtonElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();