From 19ca6f68ba51d6b5506934832742f110a0e35498 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Wed, 4 Oct 2023 17:42:40 +1300 Subject: [PATCH] LibWeb: Expose NamedNodeMap::append_attribute in Element --- Userland/Libraries/LibWeb/DOM/Element.cpp | 6 ++++++ Userland/Libraries/LibWeb/DOM/Element.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index b9aa52fd81..8d3f00763c 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -270,6 +270,12 @@ WebIDL::ExceptionOr Element::set_attribute_ns(Optional const& name return {}; } +// https://dom.spec.whatwg.org/#concept-element-attributes-append +void Element::append_attribute(Attr& attribute) +{ + m_attributes->append_attribute(attribute); +} + // https://dom.spec.whatwg.org/#concept-element-attributes-set-value void Element::set_attribute_value(FlyString const& local_name, DeprecatedString const& value, Optional const& prefix, DeprecatedFlyString const& namespace_) { diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index db0477be01..d4c4eb4ce0 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -122,6 +122,8 @@ public: WebIDL::ExceptionOr> set_attribute_node(Attr&); WebIDL::ExceptionOr> set_attribute_node_ns(Attr&); + void append_attribute(Attr&); + // FIXME: This should take a 'FlyString cosnt&' void remove_attribute(StringView name);