diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/custom/custom_element.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/html/custom/custom_element.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc b/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc index d21c582052c..1a031cecfab 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc @@ -56,8 +56,7 @@ Vector<AtomicString>& CustomElement::EmbedderCustomElementNames() { void CustomElement::AddEmbedderCustomElementName(const AtomicString& name) { DCHECK_EQ(name, name.LowerASCII()); DCHECK(Document::IsValidName(name)) << name; - DCHECK_EQ(HTMLElementType::kHTMLUnknownElement, htmlElementTypeForTag(name)) - << name; + DCHECK(!IsKnownBuiltinTagName(name)) << name; DCHECK(!IsValidName(name, false)) << name; if (EmbedderCustomElementNames().Contains(name)) @@ -69,8 +68,7 @@ void CustomElement::AddEmbedderCustomElementNameForTesting( const AtomicString& name, ExceptionState& exception_state) { if (name != name.LowerASCII() || !Document::IsValidName(name) || - HTMLElementType::kHTMLUnknownElement != htmlElementTypeForTag(name) || - IsValidName(name, false)) { + IsKnownBuiltinTagName(name) || IsValidName(name, false)) { exception_state.ThrowDOMException(DOMExceptionCode::kSyntaxError, "Name cannot be used"); return; @@ -105,14 +103,16 @@ bool CustomElement::ShouldCreateCustomElement(const QualifiedName& tag_name) { } bool CustomElement::ShouldCreateCustomizedBuiltinElement( - const AtomicString& local_name) { - return htmlElementTypeForTag(local_name) != + const AtomicString& local_name, + const Document& document) { + return htmlElementTypeForTag(local_name, &document) != HTMLElementType::kHTMLUnknownElement; } bool CustomElement::ShouldCreateCustomizedBuiltinElement( - const QualifiedName& tag_name) { - return ShouldCreateCustomizedBuiltinElement(tag_name.LocalName()) && + const QualifiedName& tag_name, + const Document& document) { + return ShouldCreateCustomizedBuiltinElement(tag_name.LocalName(), document) && tag_name.NamespaceURI() == html_names::xhtmlNamespaceURI; } @@ -205,7 +205,8 @@ Element* CustomElement::CreateUncustomizedOrUndefinedElement( HTMLElement* CustomElement::CreateFailedElement(Document& document, const QualifiedName& tag_name) { - DCHECK(ShouldCreateCustomElement(tag_name)); + CHECK(ShouldCreateCustomElement(tag_name)) + << "HTMLUnknownElement with built-in tag name: " << tag_name; // "create an element for a token": // https://html.spec.whatwg.org/C/#create-an-element-for-the-token |