mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-29 18:47:31 +09:00
Bug 1419643 - Don't need to lookup custom element definition for a non-custom element
Tag UXP Issue #1344
This commit is contained in:
parent
5db13d0f4b
commit
5776911c05
1 changed files with 8 additions and 5 deletions
|
|
@ -275,12 +275,18 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
|
||||||
|
|
||||||
int32_t tag = parserService->HTMLCaseSensitiveAtomTagToId(name);
|
int32_t tag = parserService->HTMLCaseSensitiveAtomTagToId(name);
|
||||||
|
|
||||||
|
bool isCustomElementName = (tag == eHTMLTag_userdefined &&
|
||||||
|
nsContentUtils::IsCustomElementName(name));
|
||||||
|
bool isCustomElement = isCustomElementName || aIs;
|
||||||
|
MOZ_ASSERT_IF(aDefinition, isCustomElement);
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#concept-create-element
|
// https://dom.spec.whatwg.org/#concept-create-element
|
||||||
// We only handle the "synchronous custom elements flag is set" now.
|
// We only handle the "synchronous custom elements flag is set" now.
|
||||||
// For the unset case (e.g. cloning a node), see bug 1319342 for that.
|
// For the unset case (e.g. cloning a node), see bug 1319342 for that.
|
||||||
// Step 4.
|
// Step 4.
|
||||||
CustomElementDefinition* definition = aDefinition;
|
CustomElementDefinition* definition = aDefinition;
|
||||||
if (!definition && CustomElementRegistry::IsCustomElementEnabled()) {
|
if (CustomElementRegistry::IsCustomElementEnabled() && isCustomElement &&
|
||||||
|
!definition) {
|
||||||
definition =
|
definition =
|
||||||
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
||||||
nodeInfo->LocalName(),
|
nodeInfo->LocalName(),
|
||||||
|
|
@ -363,8 +369,6 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
|
||||||
|
|
||||||
// Per the Custom Element specification, unknown tags that are valid custom
|
// Per the Custom Element specification, unknown tags that are valid custom
|
||||||
// element names should be HTMLElement instead of HTMLUnknownElement.
|
// element names should be HTMLElement instead of HTMLUnknownElement.
|
||||||
bool isCustomElementName = (tag == eHTMLTag_userdefined &&
|
|
||||||
nsContentUtils::IsCustomElementName(name));
|
|
||||||
if (isCustomElementName) {
|
if (isCustomElementName) {
|
||||||
NS_IF_ADDREF(*aResult = NS_NewHTMLElement(nodeInfo.forget(), aFromParser));
|
NS_IF_ADDREF(*aResult = NS_NewHTMLElement(nodeInfo.forget(), aFromParser));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -375,8 +379,7 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CustomElementRegistry::IsCustomElementEnabled() &&
|
if (CustomElementRegistry::IsCustomElementEnabled() && isCustomElement) {
|
||||||
(isCustomElementName || aIs)) {
|
|
||||||
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
|
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue