Index: third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp |
index 8da5f43b04b0a562c632977f40902cca1a9dd23c..8296c3ab40c53843c270451d94618dba8c536f55 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp |
@@ -16,7 +16,11 @@ CustomElementUpgradeReaction::CustomElementUpgradeReaction( |
void CustomElementUpgradeReaction::invoke(Element* element) |
{ |
- m_definition->upgrade(element); |
+ // Don't call upgrade() if it's already upgraded. Multiple upgrade reactions |
+ // could be enqueued because the state changes in step 10 of upgrades. |
+ // https://html.spec.whatwg.org/multipage/scripting.html#upgrades |
+ if (element->getCustomElementState() == CustomElementState::Undefined) |
+ m_definition->upgrade(element); |
} |
} // namespace blink |