summaryrefslogtreecommitdiffstats
path: root/dom/base/Element.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-05 15:46:37 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:28 -0500
commit186782301c03f4b27e4edae07b0280e92c4e01d1 (patch)
treedf00e6dbd5de72de0d5c7ab62ddc089bb93c86bd /dom/base/Element.cpp
parent42331663e643b8366c4ec87a929161fa3fb8d775 (diff)
downloadUXP-186782301c03f4b27e4edae07b0280e92c4e01d1.tar
UXP-186782301c03f4b27e4edae07b0280e92c4e01d1.tar.gz
UXP-186782301c03f4b27e4edae07b0280e92c4e01d1.tar.lz
UXP-186782301c03f4b27e4edae07b0280e92c4e01d1.tar.xz
UXP-186782301c03f4b27e4edae07b0280e92c4e01d1.zip
Bug 1334043 - Part 1: Replace attached callback (v0) with connected callback (v1).
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/Element.cpp')
-rw-r--r--dom/base/Element.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp
index e90d44476..7ab0699ed 100644
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1685,13 +1685,12 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
nsIDocument* composedDoc = GetComposedDoc();
- if (composedDoc) {
- // Attached callback must be enqueued whenever custom element is inserted into a
- // document and this document has a browsing context.
- if (GetCustomElementData() && composedDoc->GetDocShell()) {
- // Enqueue an attached callback for the custom element.
+ if (CustomElementRegistry::IsCustomElementEnabled() && composedDoc) {
+ // Connected callback must be enqueued whenever a custom element becomes
+ // connected.
+ if (GetCustomElementData()) {
nsContentUtils::EnqueueLifecycleCallback(
- composedDoc, nsIDocument::eAttached, this);
+ composedDoc, nsIDocument::eConnected, this);
}
}
@@ -2586,7 +2585,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
UpdateState(aNotify);
- if (nsContentUtils::IsWebComponentsEnabled()) {
+ if (CustomElementRegistry::IsCustomElementEnabled()) {
if (CustomElementData* data = GetCustomElementData()) {
if (CustomElementDefinition* definition =
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
@@ -2853,7 +2852,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
UpdateState(aNotify);
- if (nsContentUtils::IsWebComponentsEnabled()) {
+ if (CustomElementRegistry::IsCustomElementEnabled()) {
if (CustomElementData* data = GetCustomElementData()) {
if (CustomElementDefinition* definition =
nsContentUtils::GetElementDefinitionIfObservingAttr(this,