mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Bug 1334051 - Part 1: Include namespace in attributeChangedCallback.
Per spec [1], we should include namesapce in attributeChangedCallback argurment list. [1] https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element, step 3 Tag UXP Issue #1344
This commit is contained in:
parent
729ffa53f3
commit
4408e19e96
4 changed files with 15 additions and 4 deletions
|
|
@ -52,7 +52,7 @@ CustomElementCallback::Call()
|
|||
break;
|
||||
case nsIDocument::eAttributeChanged:
|
||||
static_cast<LifecycleAttributeChangedCallback *>(mCallback.get())->Call(mThisObject,
|
||||
mArgs.name, mArgs.oldValue, mArgs.newValue, rv);
|
||||
mArgs.name, mArgs.oldValue, mArgs.newValue, mArgs.namespaceURI, rv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ struct LifecycleCallbackArgs
|
|||
nsString name;
|
||||
nsString oldValue;
|
||||
nsString newValue;
|
||||
nsString namespaceURI;
|
||||
};
|
||||
|
||||
class CustomElementCallback
|
||||
|
|
|
|||
|
|
@ -2590,11 +2590,15 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
|||
if (ownerDoc && GetCustomElementData()) {
|
||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
|
||||
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
aModType == nsIDOMMutationEvent::ADDITION ?
|
||||
NullString() : nsDependentAtomString(oldValueAtom),
|
||||
nsDependentAtomString(newValueAtom)
|
||||
nsDependentAtomString(newValueAtom),
|
||||
(ns.IsEmpty() ? NullString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
|
|
@ -2845,11 +2849,14 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc && GetCustomElementData()) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
nsDependentAtomString(oldValueAtom),
|
||||
NullString()
|
||||
NullString(),
|
||||
(ns.IsEmpty() ? NullString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@
|
|||
callback LifecycleCreatedCallback = void();
|
||||
callback LifecycleAttachedCallback = void();
|
||||
callback LifecycleDetachedCallback = void();
|
||||
callback LifecycleAttributeChangedCallback = void(DOMString attrName, DOMString? oldValue, DOMString? newValue);
|
||||
callback LifecycleAttributeChangedCallback = void(DOMString attrName,
|
||||
DOMString? oldValue,
|
||||
DOMString? newValue,
|
||||
DOMString? namespaceURI);
|
||||
|
||||
dictionary LifecycleCallbacks {
|
||||
LifecycleCreatedCallback? createdCallback;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue