diff --git a/Userland/Libraries/LibWeb/DOM/Attr.h b/Userland/Libraries/LibWeb/DOM/Attr.h index 4d171c04e1c..bcfe5ed3d4f 100644 --- a/Userland/Libraries/LibWeb/DOM/Attr.h +++ b/Userland/Libraries/LibWeb/DOM/Attr.h @@ -29,7 +29,7 @@ public: DeprecatedFlyString const& namespace_uri() const { return m_qualified_name.namespace_(); } DeprecatedFlyString const& prefix() const { return m_qualified_name.prefix(); } DeprecatedFlyString const& local_name() const { return m_qualified_name.local_name(); } - DeprecatedString const& name() const { return m_qualified_name.as_string(); } + DeprecatedFlyString const& name() const { return m_qualified_name.as_string(); } DeprecatedString const& value() const { return m_value; } void set_value(DeprecatedString value); diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 432fc355119..3c1e38883b4 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -705,7 +705,7 @@ void Element::make_html_uppercased_qualified_name() { // This is allowed by the spec: "User agents could optimize qualified name and HTML-uppercased qualified name by storing them in internal slots." if (namespace_() == Namespace::HTML && document().document_type() == Document::Type::HTML) - m_html_uppercased_qualified_name = qualified_name().to_uppercase(); + m_html_uppercased_qualified_name = DeprecatedString(qualified_name()).to_uppercase(); else m_html_uppercased_qualified_name = qualified_name(); } diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 221bf125926..61c9a3b2f2a 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -71,7 +71,7 @@ class Element public: virtual ~Element() override; - DeprecatedString const& qualified_name() const { return m_qualified_name.as_string(); } + DeprecatedFlyString const& qualified_name() const { return m_qualified_name.as_string(); } DeprecatedString const& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; } virtual DeprecatedFlyString node_name() const final { return html_uppercased_qualified_name(); } DeprecatedFlyString const& local_name() const { return m_qualified_name.local_name(); } diff --git a/Userland/Libraries/LibWeb/DOM/ParentNode.cpp b/Userland/Libraries/LibWeb/DOM/ParentNode.cpp index db38f3af5de..cb45bdb7118 100644 --- a/Userland/Libraries/LibWeb/DOM/ParentNode.cpp +++ b/Userland/Libraries/LibWeb/DOM/ParentNode.cpp @@ -133,10 +133,11 @@ JS::NonnullGCPtr ParentNode::get_elements_by_tag_name(Deprecated // 2. Otherwise, if root’s node document is an HTML document, return a HTMLCollection rooted at root, whose filter matches the following descendant elements: if (root().document().document_type() == Document::Type::HTML) { - return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [qualified_name](Element const& element) { + auto qualified_name_in_ascii_lowercase = qualified_name.to_lowercase(); + return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [qualified_name, qualified_name_in_ascii_lowercase](Element const& element) { // - Whose namespace is the HTML namespace and whose qualified name is qualifiedName, in ASCII lowercase. if (element.namespace_() == Namespace::HTML) - return element.qualified_name().to_lowercase() == qualified_name.to_lowercase(); + return element.qualified_name() == qualified_name_in_ascii_lowercase; // - Whose namespace is not the HTML namespace and whose qualified name is qualifiedName. return element.qualified_name() == qualified_name; diff --git a/Userland/Libraries/LibWeb/DOM/QualifiedName.h b/Userland/Libraries/LibWeb/DOM/QualifiedName.h index 4c90cbdd5bc..d91eb4e9280 100644 --- a/Userland/Libraries/LibWeb/DOM/QualifiedName.h +++ b/Userland/Libraries/LibWeb/DOM/QualifiedName.h @@ -19,7 +19,7 @@ public: DeprecatedFlyString const& prefix() const { return m_impl->prefix; } DeprecatedFlyString const& namespace_() const { return m_impl->namespace_; } - DeprecatedString const& as_string() const { return m_impl->as_string; } + DeprecatedFlyString const& as_string() const { return m_impl->as_string; } struct Impl : public RefCounted { Impl(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_); @@ -29,7 +29,7 @@ public: DeprecatedFlyString local_name; DeprecatedFlyString prefix; DeprecatedFlyString namespace_; - DeprecatedString as_string; + DeprecatedFlyString as_string; }; void set_prefix(DeprecatedFlyString const& value);