mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
LibWeb: Port HTMLCollection from DeprecatedString to String
This commit is contained in:
parent
ebdfe2e863
commit
d5409a056a
4 changed files with 7 additions and 5 deletions
|
@ -77,8 +77,10 @@ Element* HTMLCollection::item(size_t index) const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem-key
|
||||
Element* HTMLCollection::named_item(DeprecatedFlyString const& name) const
|
||||
Element* HTMLCollection::named_item(FlyString const& name_) const
|
||||
{
|
||||
auto name = name_.to_deprecated_fly_string();
|
||||
|
||||
// 1. If key is the empty string, return null.
|
||||
if (name.is_empty())
|
||||
return nullptr;
|
||||
|
@ -147,7 +149,7 @@ WebIDL::ExceptionOr<JS::Value> HTMLCollection::item_value(size_t index) const
|
|||
|
||||
WebIDL::ExceptionOr<JS::Value> HTMLCollection::named_item_value(DeprecatedFlyString const& index) const
|
||||
{
|
||||
auto* element = named_item(index);
|
||||
auto* element = named_item(FlyString::from_deprecated_fly_string(index).release_value());
|
||||
if (!element)
|
||||
return JS::js_undefined();
|
||||
return const_cast<Element*>(element);
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
size_t length() const;
|
||||
Element* item(size_t index) const;
|
||||
Element* named_item(DeprecatedFlyString const& name) const;
|
||||
Element* named_item(FlyString const& name) const;
|
||||
|
||||
JS::MarkedVector<Element*> collect_matching_elements() const;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#import <DOM/Element.idl>
|
||||
|
||||
[Exposed=Window, LegacyUnenumerableNamedProperties]
|
||||
[Exposed=Window, LegacyUnenumerableNamedProperties, UseNewAKString]
|
||||
interface HTMLCollection {
|
||||
|
||||
readonly attribute unsigned long length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue