浏览代码

LibWeb: Use Element::id() in Window::supported_property_names()

We already have the `id` attribute cached on elements, so we don't
need to walk the attribute list to find it.
Andreas Kling 1 年之前
父节点
当前提交
0178929387
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Userland/Libraries/LibWeb/HTML/Window.cpp

+ 4 - 4
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -1554,7 +1554,7 @@ Vector<String> Window::supported_property_names()
     // The supported property names of a Window object window at any moment consist of the following,
     // in tree order according to the element that contributed them, ignoring later duplicates:
 
-    HashTable<String> property_names;
+    HashTable<FlyString> property_names;
 
     // - window's document-tree child navigable target name property set;
     auto child_navigable_property_set = document_tree_child_navigable_target_name_property_set();
@@ -1570,15 +1570,15 @@ Vector<String> Window::supported_property_names()
             if (auto const& name = element.attribute(AttributeNames::name); name.has_value())
                 property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
         }
-        if (auto const& name = element.attribute(AttributeNames::id); name.has_value())
-            property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
+        if (auto const& name = element.id(); name.has_value())
+            property_names.set(name.value().to_string(), AK::HashSetExistingEntryBehavior::Keep);
         return IterationDecision::Continue;
     });
 
     Vector<String> names;
     names.ensure_capacity(property_names.size());
     for (auto const& name : property_names) {
-        names.append(name);
+        names.append(name.to_string());
     }
 
     return names;