LibWeb: Port HTMLSelectElement from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-08-12 21:30:19 +12:00 committed by Andreas Kling
parent d5409a056a
commit d706f9f241
3 changed files with 8 additions and 8 deletions

View file

@ -62,10 +62,10 @@ DOM::Element* HTMLSelectElement::item(size_t index)
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-nameditem
DOM::Element* HTMLSelectElement::named_item(DeprecatedFlyString const& name)
DOM::Element* HTMLSelectElement::named_item(FlyString const& name)
{
// The namedItem(name) method must return the value returned by the method of the same name on the options collection, when invoked with the same argument.
return const_cast<HTMLOptionsCollection&>(*options()).named_item(FlyString::from_deprecated_fly_string(name).release_value());
return const_cast<HTMLOptionsCollection&>(*options()).named_item(name);
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-add
@ -149,11 +149,11 @@ i32 HTMLSelectElement::default_tab_index_value() const
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type
DeprecatedString const& HTMLSelectElement::type() const
String const& HTMLSelectElement::type() const
{
// The type IDL attribute, on getting, must return the string "select-one" if the multiple attribute is absent, and the string "select-multiple" if the multiple attribute is present.
static DeprecatedString select_one = "select-one"sv;
static DeprecatedString select_multiple = "select-multiple"sv;
static String const select_one = "select-one"_string;
static String const select_multiple = "select-multiple"_string;
if (!has_attribute(AttributeNames::multiple))
return select_one;

View file

@ -27,7 +27,7 @@ public:
size_t length();
DOM::Element* item(size_t index);
DOM::Element* named_item(DeprecatedFlyString const& name);
DOM::Element* named_item(FlyString const& name);
WebIDL::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
int selected_index() const;
@ -58,7 +58,7 @@ public:
virtual void reset_algorithm() override;
DeprecatedString const& type() const;
String const& type() const;
virtual Optional<ARIA::Role> default_role() const override;

View file

@ -2,7 +2,7 @@
#import <HTML/HTMLOptionsCollection.idl>
// https://html.spec.whatwg.org/multipage/form-elements.html#htmlselectelement
[Exposed=Window]
[Exposed=Window, UseNewAKString]
interface HTMLSelectElement : HTMLElement {
[HTMLConstructor] constructor();