1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibWeb: Add namespace to Element

This commit is contained in:
Luke 2020-10-10 02:48:05 +01:00 committed by Andreas Kling
parent efaf03e986
commit e8a9e8aed5
167 changed files with 505 additions and 340 deletions

View file

@ -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;