summaryrefslogtreecommitdiffstats
path: root/dom/base/CustomElementRegistry.h
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-05 12:13:14 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:25 -0500
commitbf004bb63bcc9e2ea5f9417461ecb3042b27a2fa (patch)
tree8ffe8d9d391a5c72e033085f4ad02cff3757ca9a /dom/base/CustomElementRegistry.h
parent08fc057471e0f74a558de887e6f9ea9e19d42876 (diff)
downloadUXP-bf004bb63bcc9e2ea5f9417461ecb3042b27a2fa.tar
UXP-bf004bb63bcc9e2ea5f9417461ecb3042b27a2fa.tar.gz
UXP-bf004bb63bcc9e2ea5f9417461ecb3042b27a2fa.tar.lz
UXP-bf004bb63bcc9e2ea5f9417461ecb3042b27a2fa.tar.xz
UXP-bf004bb63bcc9e2ea5f9417461ecb3042b27a2fa.zip
Bug 1334051 - Part 2: Invoke attributeChangedCallback only if attribute name is in the observed attribute list.
We call attributeChangedCallback in two cases: 1. When any of the attributes in the observed attribute list has changed, appended, removed, or replaced. 2. When upgrading an element, for each attribute in element's attribute list that is in the observed attribute list. Note: w/ Fixup for not implementing an API Enhancement Bug 1363481. Tag UXP Issue #1344
Diffstat (limited to 'dom/base/CustomElementRegistry.h')
-rw-r--r--dom/base/CustomElementRegistry.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h
index b5903f978..b85d089f9 100644
--- a/dom/base/CustomElementRegistry.h
+++ b/dom/base/CustomElementRegistry.h
@@ -128,6 +128,7 @@ struct CustomElementDefinition
CustomElementDefinition(nsIAtom* aType,
nsIAtom* aLocalName,
Function* aConstructor,
+ nsCOMArray<nsIAtom>&& aObservedAttributes,
JSObject* aPrototype,
mozilla::dom::LifecycleCallbacks* aCallbacks,
uint32_t aDocOrder);
@@ -141,6 +142,9 @@ struct CustomElementDefinition
// The custom element constructor.
RefPtr<CustomElementConstructor> mConstructor;
+ // The list of attributes that this custom element observes.
+ nsCOMArray<nsIAtom> mObservedAttributes;
+
// The prototype to use for new custom elements of this type.
JS::Heap<JSObject *> mPrototype;
@@ -153,9 +157,19 @@ struct CustomElementDefinition
// The document custom element order.
uint32_t mDocOrder;
- bool IsCustomBuiltIn() {
+ bool IsCustomBuiltIn()
+ {
return mType != mLocalName;
}
+
+ bool IsInObservedAttributeList(nsIAtom* aName)
+ {
+ if (mObservedAttributes.IsEmpty()) {
+ return false;
+ }
+
+ return mObservedAttributes.Contains(aName);
+ }
};
class CustomElementReaction