From 47a466865ceeb95d64718fedf8d0dc36a1b4ff83 Mon Sep 17 00:00:00 2001 From: Srikavin Ramkumar Date: Thu, 23 Mar 2023 04:28:25 -0400 Subject: [PATCH] LibWeb: Return HTMLElement for valid custom element tag names --- Userland/Libraries/LibWeb/DOM/ElementFactory.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp b/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp index d848927365..ac55706a5b 100644 --- a/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp +++ b/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -291,8 +292,10 @@ WebIDL::ExceptionOr> create_element(Document& document if (lowercase_tag_name == SVG::TagNames::text) return MUST_OR_THROW_OOM(realm.heap().allocate(realm, document, move(qualified_name))); - // FIXME: If name is a valid custom element name, then return HTMLElement. - + // If name is a valid custom element name, then return HTMLElement. + if (HTML::is_valid_custom_element_name(local_name)) { + return MUST_OR_THROW_OOM(realm.heap().allocate(realm, document, move(qualified_name))); + } return MUST_OR_THROW_OOM(realm.heap().allocate(realm, document, move(qualified_name))); }