diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-19 23:33:52 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:46 -0500 |
commit | 93313b0ce3aada87f76948e6c65d455ee4998acf (patch) | |
tree | fd8285a120168d8c6adf004c5822b4379acd4b46 /dom/base/Element.cpp | |
parent | fb657f7a1e3ef326214e0c42a5a0dd6dc0109338 (diff) | |
download | UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar.gz UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar.lz UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar.xz UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.zip |
Bug 1406325 - Part 5: Implement try to upgrade.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/Element.cpp')
-rw-r--r-- | dom/base/Element.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index fdaaed62a..e77b43b86 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -1688,8 +1688,13 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent, // Connected callback must be enqueued whenever a custom element becomes // connected. CustomElementData* data = GetCustomElementData(); - if (data && data->mState == CustomElementData::State::eCustom) { - nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this); + if (data) { + if (data->mState == CustomElementData::State::eCustom) { + nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this); + } else { + // Step 7.7.2.2 https://dom.spec.whatwg.org/#concept-node-insert + nsContentUtils::TryToUpgradeElement(this); + } } } @@ -1988,9 +1993,16 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent) // disconnected. if (CustomElementRegistry::IsCustomElementEnabled()) { CustomElementData* data = GetCustomElementData(); - if (data && data->mState == CustomElementData::State::eCustom) { - nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected, - this); + if (data) { + if (data->mState == CustomElementData::State::eCustom) { + nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected, + this); + } else { + // Remove an unresolved custom element that is a candidate for + // upgrade when a custom element is disconnected. + // We will make sure it's shadow-including tree order in bug 1326028. + nsContentUtils::UnregisterUnresolvedElement(this); + } } } } |