diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-05 11:25:37 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:25 -0500 |
commit | 08fc057471e0f74a558de887e6f9ea9e19d42876 (patch) | |
tree | b74b8260f562f73b5979ca839b4dc1a38f72c3da | |
parent | 704318ea0a9f55cad18c4ea7f2a6805485a33d39 (diff) | |
download | UXP-08fc057471e0f74a558de887e6f9ea9e19d42876.tar UXP-08fc057471e0f74a558de887e6f9ea9e19d42876.tar.gz UXP-08fc057471e0f74a558de887e6f9ea9e19d42876.tar.lz UXP-08fc057471e0f74a558de887e6f9ea9e19d42876.tar.xz UXP-08fc057471e0f74a558de887e6f9ea9e19d42876.zip |
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
-rw-r--r-- | dom/base/CustomElementRegistry.cpp | 2 | ||||
-rw-r--r-- | dom/base/CustomElementRegistry.h | 1 | ||||
-rw-r--r-- | dom/base/Element.cpp | 11 | ||||
-rw-r--r-- | dom/webidl/WebComponents.webidl | 5 |
4 files changed, 15 insertions, 4 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index e619ad599..cc6264b03 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -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; } } diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index c45f3f70c..b5903f978 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -34,6 +34,7 @@ struct LifecycleCallbackArgs nsString name; nsString oldValue; nsString newValue; + nsString namespaceURI; }; class CustomElementCallback diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 81cc41210..247fbe79e 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -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( diff --git a/dom/webidl/WebComponents.webidl b/dom/webidl/WebComponents.webidl index 3dfb960bc..19ca38c0d 100644 --- a/dom/webidl/WebComponents.webidl +++ b/dom/webidl/WebComponents.webidl @@ -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; |