From 4a82f9bd03b7e7c5e53679f47e5027a4d2388acf Mon Sep 17 00:00:00 2001 From: Srikavin Ramkumar Date: Thu, 23 Mar 2023 04:29:20 -0400 Subject: LibWeb: Allow attachshadow for elements with valid custom element names --- Userland/Libraries/LibWeb/DOM/Element.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index bb88bbd673..c09f9d2f17 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -485,9 +486,10 @@ WebIDL::ExceptionOr> Element::attach_shadow(ShadowR return WebIDL::NotSupportedError::create(realm(), "Element's namespace is not the HTML namespace"sv); // 2. If this’s local name is not one of the following: - // FIXME: - a valid custom element name + // - a valid custom element name // - "article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "main", "nav", "p", "section", or "span" - if (!local_name().is_one_of("article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "main", "nav", "p", "section", "span")) { + if (!HTML::is_valid_custom_element_name(local_name()) + && !local_name().is_one_of("article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "main", "nav", "p", "section", "span")) { // then throw a "NotSupportedError" DOMException. return WebIDL::NotSupportedError::create(realm(), DeprecatedString::formatted("Element '{}' cannot be a shadow host", local_name())); } -- cgit v1.2.3