LibWeb: Don't advertise the empty string as HTMLCollection property name

This fixes wpt/dom/collections/HTMLCollection-empty-name.html
This commit is contained in:
Andreas Kling
2024-05-27 10:47:19 +02:00
parent 8988dce93d
commit e7febd347b
3 changed files with 13 additions and 1 deletions

View File

@@ -135,7 +135,7 @@ Vector<FlyString> HTMLCollection::supported_property_names() const
for (auto const& element : m_cached_elements) {
// 1. If element has an ID which is not in result, append elements ID to result.
if (auto const& id = element->id(); id.has_value()) {
if (!result.contains_slow(id.value()))
if (!id.value().is_empty() && !result.contains_slow(id.value()))
result.append(id.value());
}