浏览代码

LibWeb: Implement the Element attributes getter

Timothy Flynn 3 年之前
父节点
当前提交
5d4cd061c7
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      Userland/Libraries/LibWeb/DOM/Element.h
  2. 1 0
      Userland/Libraries/LibWeb/DOM/Element.idl

+ 1 - 0
Userland/Libraries/LibWeb/DOM/Element.h

@@ -56,6 +56,7 @@ public:
     ExceptionOr<void> set_attribute(const FlyString& name, const String& value);
     void remove_attribute(const FlyString& name);
     size_t attribute_list_size() const { return m_attributes->length(); }
+    NonnullRefPtr<NamedNodeMap> const& attributes() const { return m_attributes; }
 
     DOM::ExceptionOr<bool> matches(StringView selectors) const;
 

+ 1 - 0
Userland/Libraries/LibWeb/DOM/Element.idl

@@ -9,6 +9,7 @@ interface Element : Node {
     undefined removeAttribute(DOMString qualifiedName);
     boolean hasAttribute(DOMString qualifiedName);
     boolean hasAttributes();
+    [SameObject] readonly attribute NamedNodeMap attributes;
 
     HTMLCollection getElementsByTagName(DOMString tagName);
     HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);