diff options
author | Luke <luke.wilde@live.co.uk> | 2020-10-10 02:48:05 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-22 15:24:42 +0200 |
commit | e8a9e8aed51fc6a6b1c03d2b84f714ede5bcb341 (patch) | |
tree | 957ea71bf4d8554b5c545b40a00f35f03c461440 /Libraries/LibWeb/DOM/Element.h | |
parent | efaf03e986337e096e16e1aee938ddc9f8df97f4 (diff) | |
download | serenity-e8a9e8aed51fc6a6b1c03d2b84f714ede5bcb341.zip |
LibWeb: Add namespace to Element
Diffstat (limited to 'Libraries/LibWeb/DOM/Element.h')
-rw-r--r-- | Libraries/LibWeb/DOM/Element.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index 253f532aff..19dba993e5 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -34,6 +34,7 @@ #include <LibWeb/DOM/TagNames.h> #include <LibWeb/HTML/AttributeNames.h> #include <LibWeb/Layout/LayoutNode.h> +#include <LibWeb/QualifiedName.h> namespace Web::DOM { @@ -44,15 +45,20 @@ class Element public: using WrapperType = Bindings::ElementWrapper; - Element(Document&, const FlyString& local_name); + Element(Document&, const QualifiedName& qualified_name); virtual ~Element() override; - virtual FlyString node_name() const final { return m_tag_name; } - const FlyString& local_name() const { return m_tag_name; } + virtual FlyString node_name() const final { return m_qualified_name.local_name(); } + const FlyString& local_name() const { return m_qualified_name.local_name(); } // NOTE: This is for the JS bindings const FlyString& tag_name() const { return local_name(); } + const FlyString& namespace_() const { return m_qualified_name.namespace_(); } + + // NOTE: This is for the JS bindings + const FlyString& namespace_uri() const { return namespace_(); } + bool has_attribute(const FlyString& name) const { return !attribute(name).is_null(); } String attribute(const FlyString& name) const; String get_attribute(const FlyString& name) const { return attribute(name); } @@ -100,7 +106,7 @@ private: Attribute* find_attribute(const FlyString& name); const Attribute* find_attribute(const FlyString& name) const; - FlyString m_tag_name; + QualifiedName m_qualified_name; Vector<Attribute> m_attributes; RefPtr<CSS::StyleProperties> m_resolved_style; |