summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2020-12-29 20:37:40 +0000
committerAndreas Kling <kling@serenityos.org>2020-12-29 23:38:14 +0100
commit18d99919be24558d9e364369873af545801145c7 (patch)
treedea87b748cfc8567b5a9c0bcf2ea0a2e1b44e650
parentb05f048c05dfe55421abd9fb465d0b94209b230a (diff)
downloadserenity-18d99919be24558d9e364369873af545801145c7.zip
LibWeb: Expose three more attribute methods on Element
Exposes removeAttribute, hasAttribute and hasAttributes.
-rw-r--r--Libraries/LibWeb/DOM/Element.h1
-rw-r--r--Libraries/LibWeb/DOM/Element.idl3
2 files changed, 4 insertions, 0 deletions
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;