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

Unified Diff: Source/core/dom/Element.cpp

Issue 17707002: Implement Custom Elements inserted and removed callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 8df5e79ab407fa858be4c1cfe83b049e1602ea14..b9b47ed1333105f2b1cd84ceb4c412c6ff0c0db0 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -939,9 +939,8 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason)
{
- if (RuntimeEnabledFeatures::customDOMElementsEnabled() && name == isAttr) {
- document()->ensureCustomElementRegistry()->didGiveTypeExtension(this, newValue);
- }
+ if (RuntimeEnabledFeatures::customDOMElementsEnabled() && name == isAttr)
+ document()->ensureCustomElementRegistry()->didGiveTypeExtension(this, newValue, true);
attributeChanged(name, newValue, reason);
}
@@ -1255,6 +1254,11 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio
if (hasRareData())
elementRareData()->clearClassListValueForQuirksMode();
+ if (isCustomElement()) {
+ if (CustomElementRegistry* registry = document()->registry())
+ registry->customElementWasInsertedIntoDocument(this);
+ }
+
TreeScope* scope = insertionPoint->treeScope();
if (scope != treeScope())
return InsertionDone;
@@ -1311,8 +1315,15 @@ void Element::removedFrom(ContainerNode* insertionPoint)
}
ContainerNode::removedFrom(insertionPoint);
- if (wasInDocument && hasPendingResources())
- document()->accessSVGExtensions()->removeElementFromPendingResources(this);
+ if (wasInDocument) {
+ if (hasPendingResources())
+ document()->accessSVGExtensions()->removeElementFromPendingResources(this);
+
+ if (isCustomElement()) {
+ if (CustomElementRegistry* registry = document()->registry())
+ registry->customElementWasRemovedFromDocument(this);
+ }
+ }
}
void Element::createRendererIfNeeded(const AttachContext& context)

Powered by Google App Engine
This is Rietveld 408576698