updatedAncestorInfoDev() — react Function Reference
Architecture documentation for the updatedAncestorInfoDev() function in validateDOMNesting.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD a4ba4936_0674_70b5_2067_34a9fc1f6384["updatedAncestorInfoDev()"] 99b6f05f_c8d3_afa4_842b_34ebebb1f8a7["validateDOMNesting.js"] a4ba4936_0674_70b5_2067_34a9fc1f6384 -->|defined in| 99b6f05f_c8d3_afa4_842b_34ebebb1f8a7 style a4ba4936_0674_70b5_2067_34a9fc1f6384 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/validateDOMNesting.js lines 224–297
function updatedAncestorInfoDev(
oldInfo: null | AncestorInfoDev,
tag: string,
): AncestorInfoDev {
if (__DEV__) {
const ancestorInfo = {...(oldInfo || emptyAncestorInfoDev)};
const info = {tag};
if (inScopeTags.indexOf(tag) !== -1) {
ancestorInfo.aTagInScope = null;
ancestorInfo.buttonTagInScope = null;
ancestorInfo.nobrTagInScope = null;
}
if (buttonScopeTags.indexOf(tag) !== -1) {
ancestorInfo.pTagInButtonScope = null;
}
if (
specialTags.indexOf(tag) !== -1 &&
tag !== 'address' &&
tag !== 'div' &&
tag !== 'p'
) {
// See rules for 'li', 'dd', 'dt' start tags in
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
ancestorInfo.listItemTagAutoclosing = null;
ancestorInfo.dlItemTagAutoclosing = null;
}
ancestorInfo.current = info;
if (tag === 'form') {
ancestorInfo.formTag = info;
}
if (tag === 'a') {
ancestorInfo.aTagInScope = info;
}
if (tag === 'button') {
ancestorInfo.buttonTagInScope = info;
}
if (tag === 'nobr') {
ancestorInfo.nobrTagInScope = info;
}
if (tag === 'p') {
ancestorInfo.pTagInButtonScope = info;
}
if (tag === 'li') {
ancestorInfo.listItemTagAutoclosing = info;
}
if (tag === 'dd' || tag === 'dt') {
ancestorInfo.dlItemTagAutoclosing = info;
}
if (tag === '#document' || tag === 'html') {
ancestorInfo.containerTagInScope = null;
} else if (!ancestorInfo.containerTagInScope) {
ancestorInfo.containerTagInScope = info;
}
if (
oldInfo === null &&
(tag === '#document' || tag === 'html' || tag === 'body')
) {
// While <head> is also a singleton we don't want to support semantics where
// you can escape the head by rendering a body singleton so we treat it like a normal scope
ancestorInfo.implicitRootScope = true;
} else if (ancestorInfo.implicitRootScope === true) {
ancestorInfo.implicitRootScope = false;
}
return ancestorInfo;
} else {
return (null: any);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does updatedAncestorInfoDev() do?
updatedAncestorInfoDev() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/validateDOMNesting.js.
Where is updatedAncestorInfoDev() defined?
updatedAncestorInfoDev() is defined in packages/react-dom-bindings/src/client/validateDOMNesting.js at line 224.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free