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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2002903002: Hook createElement for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dominicc review Created 4 years, 7 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/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 75cd184962ba7a88a7a223f0c85ed9601f275c9e..74dc333aad2f3daaf68052296a26003c298475ea 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -105,6 +105,7 @@
#include "core/dom/TreeWalker.h"
#include "core/dom/VisitedLinkState.h"
#include "core/dom/XMLDocument.h"
+#include "core/dom/custom/CustomElement.h"
#include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h"
#include "core/dom/custom/V0CustomElementRegistrationContext.h"
#include "core/dom/shadow/ElementShadow.h"
@@ -679,7 +680,9 @@ Element* Document::createElement(const AtomicString& localName, const AtomicStri
Element* element;
- if (V0CustomElement::isValidName(localName) && registrationContext()) {
+ if (CustomElement::shouldCreateCustomElement(*this, localName)) {
+ element = CustomElement::createCustomElement(*this, localName);
+ } else if (V0CustomElement::isValidName(localName) && registrationContext()) {
element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, convertLocalName(localName), xhtmlNamespaceURI));
} else {
element = createElement(localName, exceptionState);
@@ -724,7 +727,9 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
return nullptr;
Element* element;
- if (V0CustomElement::isValidName(qName.localName()) && registrationContext())
+ if (CustomElement::shouldCreateCustomElement(*this, qName))
+ element = CustomElement::createCustomElement(*this, qName);
+ else if (V0CustomElement::isValidName(qName.localName()) && registrationContext())
element = registrationContext()->createCustomTagElement(*this, qName);
else
element = createElement(qName, false);

Powered by Google App Engine
This is Rietveld 408576698