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

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

Issue 2067853002: Upgrade custom elements when inserting a node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor editorial Created 4 years, 6 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 f2d27d95ca9fc53d8e08912523b735382b2afc97..9a25fae89425cffb20de18482d8f72cd61635d28 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -186,4 +186,20 @@ void CustomElement::enqueueAttributeChangedCallback(Element* element,
definition->enqueueAttributeChangedCallback(element, name, oldValue, newValue);
}
+void CustomElement::tryToUpgrade(Element* element)
+{
+ // Try to upgrade an element
+ // https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade
+
+ DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined);
+
+ CustomElementsRegistry* registry = CustomElement::registry(*element);
+ if (!registry)
+ return;
+ if (CustomElementDefinition* definition = registry->definitionForName(element->localName()))
+ definition->enqueueUpgradeReaction(element);
+ else
+ registry->addCandidate(element);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698