Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp

Issue 2173623003: Add "Failed" custom element state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid multiple toElement Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1156806d5fd6dde1670b8356dbed13ad4effb619..6e2242b3a7aebbb1310e4bc0fc4185ce2e7bd8f1 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"
@@ -168,6 +169,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

Powered by Google App Engine
This is Rietveld 408576698