MCPcopy Index your code
hub / github.com/caseywebdev/react-list / validateDOMNesting

Function validateDOMNesting

docs/index.js:21149–21194  ·  view source on GitHub ↗
(childTag, ancestorInfo)

Source from the content-addressed store, hash-verified

21147 return null;
21148 }
21149 function validateDOMNesting(childTag, ancestorInfo) {
21150 ancestorInfo = ancestorInfo || emptyAncestorInfoDev;
21151 var parentInfo = ancestorInfo.current;
21152 ancestorInfo = (parentInfo = isTagValidWithParent(
21153 childTag,
21154 parentInfo && parentInfo.tag
21155 )
21156 ? null
21157 : parentInfo)
21158 ? null
21159 : findInvalidAncestorForTag(childTag, ancestorInfo);
21160 ancestorInfo = parentInfo || ancestorInfo;
21161 if (!ancestorInfo) return !0;
21162 ancestorInfo = ancestorInfo.tag;
21163 var warnKey = String(!!parentInfo) + "|" + childTag + "|" + ancestorInfo;
21164 if (didWarn[warnKey]) return !1;
21165 didWarn[warnKey] = !0;
21166 var ancestor = (warnKey = current)
21167 ? findAncestor(warnKey.return, ancestorInfo)
21168 : null;
21169 warnKey =
21170 null !== warnKey && null !== ancestor
21171 ? describeAncestors(ancestor, warnKey, null)
21172 : "";
21173 ancestor = "<" + childTag + ">";
21174 parentInfo
21175 ? ((parentInfo = ""),
21176 "table" === ancestorInfo &&
21177 "tr" === childTag &&
21178 (parentInfo +=
21179 " Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser."),
21180 console.error(
21181 "In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s",
21182 ancestor,
21183 ancestorInfo,
21184 parentInfo,
21185 warnKey
21186 ))
21187 : console.error(
21188 "In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s",
21189 ancestor,
21190 ancestorInfo,
21191 warnKey
21192 );
21193 return !1;
21194 }
21195 function validateTextNesting(childText, parentTag) {
21196 if (isTagValidWithParent("#text", parentTag)) return !0;
21197 var warnKey = "#text|" + parentTag;

Callers 3

beginWorkFunction · 0.85
completeWorkFunction · 0.85
resolveSingletonInstanceFunction · 0.85

Calls 4

isTagValidWithParentFunction · 0.85
findAncestorFunction · 0.85
describeAncestorsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…