diff options
Diffstat (limited to 'dom/base/nsContentUtils.cpp')
-rw-r--r-- | dom/base/nsContentUtils.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index b8ee09bf6..570065dba 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9637,6 +9637,28 @@ nsContentUtils::SetupCustomElement(Element* aElement, return registry->SetupCustomElement(aElement, aTypeExtension); } +/* static */ CustomElementDefinition* +nsContentUtils::GetElementDefinitionIfObservingAttr(Element* aCustomElement, + nsIAtom* aExtensionType, + nsIAtom* aAttrName) +{ + nsString extType = nsDependentAtomString(aExtensionType); + NodeInfo *ni = aCustomElement->NodeInfo(); + + CustomElementDefinition* definition = + LookupCustomElementDefinition(aCustomElement->OwnerDoc(), ni->LocalName(), + ni->NamespaceID(), + extType.IsEmpty() ? nullptr : &extType); + + // Custom element not defined yet or attribute is not in the observed + // attribute list. + if (!definition || !definition->IsInObservedAttributeList(aAttrName)) { + return nullptr; + } + + return definition; +} + /* static */ void nsContentUtils::EnqueueLifecycleCallback(nsIDocument* aDoc, nsIDocument::ElementCallbackType aType, |