diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 623217494c..0b7cb0d523 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -82,7 +82,8 @@ public: FlyString const& local_name() const { return m_qualified_name.local_name(); } // NOTE: This is for the JS bindings - DeprecatedString const& tag_name() const { return html_uppercased_qualified_name(); } + FlyString tag_name() const { return MUST(FlyString::from_deprecated_fly_string(html_uppercased_qualified_name())); } + DeprecatedString const& deprecated_tag_name() const { return html_uppercased_qualified_name(); } Optional const& prefix() const { return m_qualified_name.prefix(); } DeprecatedFlyString deprecated_prefix() const { return m_qualified_name.deprecated_prefix(); } diff --git a/Userland/Libraries/LibWeb/DOM/Element.idl b/Userland/Libraries/LibWeb/DOM/Element.idl index af4642eef1..c68edd068e 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.idl +++ b/Userland/Libraries/LibWeb/DOM/Element.idl @@ -26,7 +26,7 @@ interface Element : Node { readonly attribute DOMString? namespaceURI; [ImplementedAs=deprecated_prefix] readonly attribute DOMString? prefix; [ImplementedAs=deprecated_local_name] readonly attribute DOMString localName; - readonly attribute DOMString tagName; + [ImplementedAs=deprecated_tag_name] readonly attribute DOMString tagName; [ImplementedAs=deprecated_get_attribute] DOMString? getAttribute(DOMString qualifiedName); [CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 95f79d1cbd..157a67e367 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -3531,7 +3531,7 @@ void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token) } // -> An end tag whose tag name is "script", if the current node is an SVG script element - if (token.is_end_tag() && current_node().namespace_() == Namespace::SVG && current_node().tag_name() == SVG::TagNames::script) { + if (token.is_end_tag() && current_node().namespace_() == Namespace::SVG && current_node().tag_name().to_deprecated_fly_string() == SVG::TagNames::script) { ScriptEndTag: // Pop the current node off the stack of open elements. (void)m_stack_of_open_elements.pop(); @@ -3562,9 +3562,9 @@ void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token) if (token.is_end_tag()) { // 1. Initialize node to be the current node (the bottommost node of the stack). JS::GCPtr node = current_node(); - // FIXME: Not sure if this is the correct to_lowercase, as the specification says "to ASCII lowercase" + // 2. If node's tag name, converted to ASCII lowercase, is not the same as the tag name of the token, then this is a parse error. - if (node->tag_name().to_lowercase() != token.tag_name().to_deprecated_fly_string()) + if (node->tag_name().equals_ignoring_ascii_case(token.tag_name())) log_parse_error(); // 3. Loop: If node is the topmost element in the stack of open elements, then return. (fragment case) @@ -3573,10 +3573,10 @@ void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token) VERIFY(m_parsing_fragment); return; } - // FIXME: See the above FIXME + // 4. If node's tag name, converted to ASCII lowercase, is the same as the tag name of the token, pop elements from the stack // of open elements until node has been popped from the stack, and then return. - if (node->tag_name().to_lowercase() == token.tag_name().to_deprecated_fly_string()) { + if (node->tag_name().equals_ignoring_ascii_case(token.tag_name())) { while (¤t_node() != node.ptr()) (void)m_stack_of_open_elements.pop(); (void)m_stack_of_open_elements.pop(); diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index fc2e075df2..4cbfc3828f 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -1183,7 +1183,7 @@ Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_el auto qualified_name = element->tag_name(); // 5. Return success with data qualified name. - return qualified_name; + return MUST(JsonValue::from_string(qualified_name)); } // 12.4.7 Get Element Rect, https://w3c.github.io/webdriver/#dfn-get-element-rect