Index: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
index 16d712fb87c71b60087305551540950dc4e5efc6..db541d35bd0292690c37680f8840effce00810f0 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
@@ -15,6 +15,7 @@ |
#include "core/frame/FrameHost.h" |
#include "core/frame/LocalDOMWindow.h" |
#include "core/html/HTMLElement.h" |
+#include "core/html/HTMLUnknownElement.h" |
#include "platform/text/Character.h" |
#include "wtf/text/AtomicStringHash.h" |
@@ -73,6 +74,13 @@ bool CustomElement::isValidName(const AtomicString& name) |
return !hyphenContainingElementNames.contains(name); |
} |
+bool CustomElement::isDefined(CustomElementState state) |
+{ |
+ // https://dom.spec.whatwg.org/#concept-element-defined |
+ return !(static_cast<int>(state) |
+ & static_cast<int>(CustomElementState::NotDefinedFlag)); |
+} |
+ |
bool CustomElement::shouldCreateCustomElement(Document& document, const AtomicString& localName) |
{ |
return RuntimeEnabledFeatures::customElementsV1Enabled() |
@@ -160,6 +168,23 @@ HTMLElement* CustomElement::createUndefinedElement(Document& document, const Qua |
return element; |
} |
+HTMLElement* CustomElement::createFailedElement(Document& document, const QualifiedName& tagName) |
+{ |
+ DCHECK(shouldCreateCustomElement(document, tagName)); |
+ |
+ // "create an element for a token": |
+ // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token |
+ |
+ // 7. If this step throws an exception, let element be instead a new element |
+ // that implements HTMLUnknownElement, with no attributes, namespace set to |
+ // given namespace, namespace prefix set to null, custom element state set |
+ // to "failed", and node document set to document. |
+ |
+ HTMLElement* element = HTMLUnknownElement::create(tagName, document); |
+ element->setCustomElementState(CustomElementState::Failed); |
+ return element; |
+} |
+ |
void CustomElement::enqueue(Element* element, CustomElementReaction* reaction) |
{ |
// To enqueue an element on the appropriate element queue |