diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-05 15:46:37 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:28 -0500 |
commit | 186782301c03f4b27e4edae07b0280e92c4e01d1 (patch) | |
tree | df00e6dbd5de72de0d5c7ab62ddc089bb93c86bd /dom/base/Element.cpp | |
parent | 42331663e643b8366c4ec87a929161fa3fb8d775 (diff) | |
download | uxp-186782301c03f4b27e4edae07b0280e92c4e01d1.tar.gz |
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.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index e90d444767..7ab0699ed1 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, |