diff options
author | Srikavin Ramkumar <srikavinramkumar@gmail.com> | 2023-03-23 04:29:20 -0400 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-03-28 07:18:09 -0400 |
commit | 4a82f9bd03b7e7c5e53679f47e5027a4d2388acf (patch) | |
tree | e95d2db032df047876f4e0fa8c702b89411632fb /Userland | |
parent | 47a466865ceeb95d64718fedf8d0dc36a1b4ff83 (diff) | |
download | serenity-4a82f9bd03b7e7c5e53679f47e5027a4d2388acf.zip |
LibWeb: Allow attachshadow for elements with valid custom element names
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Element.cpp | 6 |
1 files 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 <LibWeb/Geometry/DOMRect.h> #include <LibWeb/Geometry/DOMRectList.h> #include <LibWeb/HTML/BrowsingContext.h> +#include <LibWeb/HTML/CustomElements/CustomElementName.h> #include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/HTMLBodyElement.h> #include <LibWeb/HTML/HTMLButtonElement.h> @@ -485,9 +486,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ShadowRoot>> 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())); } |