From 18d99919be24558d9e364369873af545801145c7 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 29 Dec 2020 20:37:40 +0000 Subject: [PATCH] LibWeb: Expose three more attribute methods on Element Exposes removeAttribute, hasAttribute and hasAttributes. --- Libraries/LibWeb/DOM/Element.h | 1 + Libraries/LibWeb/DOM/Element.idl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index d85c2115b8..45b18ef0e2 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -60,6 +60,7 @@ public: const FlyString& namespace_uri() const { return namespace_(); } bool has_attribute(const FlyString& name) const { return !attribute(name).is_null(); } + bool has_attributes() const { return !m_attributes.is_empty(); } String attribute(const FlyString& name) const; String get_attribute(const FlyString& name) const { return attribute(name); } void set_attribute(const FlyString& name, const String& value); diff --git a/Libraries/LibWeb/DOM/Element.idl b/Libraries/LibWeb/DOM/Element.idl index 386b44db3a..e5de36e75b 100644 --- a/Libraries/LibWeb/DOM/Element.idl +++ b/Libraries/LibWeb/DOM/Element.idl @@ -4,6 +4,9 @@ interface Element : Node { DOMString? getAttribute(DOMString qualifiedName); undefined setAttribute(DOMString qualifiedName, DOMString value); + undefined removeAttribute(DOMString qualifiedName); + boolean hasAttribute(DOMString qualifiedName); + boolean hasAttributes(); readonly attribute Element? firstElementChild; readonly attribute Element? lastElementChild;