mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:17:46 +00:00
LibWeb: Let supported_property_names() return Vector<FlyString>
Ultimately, this API should probably be replaced with something that updates a cache on relevant DOM mutations instead of regenerating the list of property names again and again.
This commit is contained in:
parent
0178929387
commit
41f56b0df9
19 changed files with 42 additions and 48 deletions
|
@ -99,10 +99,10 @@ Element* HTMLCollection::named_item(FlyString const& name_) const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-dfn-supported-property-names
|
||||
Vector<String> HTMLCollection::supported_property_names() const
|
||||
Vector<FlyString> HTMLCollection::supported_property_names() const
|
||||
{
|
||||
// 1. Let result be an empty list.
|
||||
Vector<String> result;
|
||||
Vector<FlyString> result;
|
||||
|
||||
// 2. For each element represented by the collection, in tree order:
|
||||
auto elements = collect_matching_elements();
|
||||
|
@ -119,7 +119,7 @@ Vector<String> HTMLCollection::supported_property_names() const
|
|||
if (auto maybe_name = element->attribute(HTML::AttributeNames::name); maybe_name.has_value()) {
|
||||
auto name = maybe_name.release_value();
|
||||
if (!name.is_empty() && !result.contains_slow(name))
|
||||
result.append(move(name));
|
||||
result.append(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
|
||||
virtual Vector<String> supported_property_names() const override;
|
||||
virtual Vector<FlyString> supported_property_names() const override;
|
||||
virtual bool is_supported_property_index(u32) const override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -49,10 +49,10 @@ bool NamedNodeMap::is_supported_property_index(u32 index) const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-dfn-supported-property-names%E2%91%A0
|
||||
Vector<String> NamedNodeMap::supported_property_names() const
|
||||
Vector<FlyString> NamedNodeMap::supported_property_names() const
|
||||
{
|
||||
// 1. Let names be the qualified names of the attributes in this NamedNodeMap object’s attribute list, with duplicates omitted, in order.
|
||||
Vector<String> names;
|
||||
Vector<FlyString> names;
|
||||
names.ensure_capacity(m_attributes.size());
|
||||
|
||||
for (auto const& attribute : m_attributes) {
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
~NamedNodeMap() = default;
|
||||
|
||||
virtual bool is_supported_property_index(u32 index) const override;
|
||||
virtual Vector<String> supported_property_names() const override;
|
||||
virtual Vector<FlyString> supported_property_names() const override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue