mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
Bug 1121994 - Implement adopted callback for custom elements.
Tag UXP Issue #1344
This commit is contained in:
parent
659204631b
commit
d35ff2985e
14 changed files with 76 additions and 130 deletions
|
|
@ -526,6 +526,23 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
|
||||
nsIDocument* newDoc = aNode->OwnerDoc();
|
||||
if (newDoc) {
|
||||
if (CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
// Adopted callback must be enqueued whenever a node’s
|
||||
// shadow-including inclusive descendants that is custom.
|
||||
Element* element = aNode->IsElement() ? aNode->AsElement() : nullptr;
|
||||
if (element) {
|
||||
RefPtr<CustomElementData> data = element->GetCustomElementData();
|
||||
if (data && data->mState == CustomElementData::State::eCustom) {
|
||||
LifecycleAdoptedCallbackArgs args = {
|
||||
oldDoc,
|
||||
newDoc
|
||||
};
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAdopted,
|
||||
element, nullptr, &args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX what if oldDoc is null, we don't know if this should be
|
||||
// registered or not! Can that really happen?
|
||||
if (wasRegistered) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue