MCPcopy Index your code
hub / github.com/react/react / getTextContent

Function getTextContent

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js:4253–4272  ·  view source on GitHub ↗
(fiber: Fiber)

Source from the content-addressed store, hash-verified

4251}
4252
4253export function getTextContent(fiber: Fiber): string | null {
4254 switch (fiber.tag) {
4255 case HostHoistable:
4256 case HostSingleton:
4257 case HostComponent:
4258 let textContent = '';
4259 const childNodes = fiber.stateNode.childNodes;
4260 for (let i = 0; i < childNodes.length; i++) {
4261 const childNode = childNodes[i];
4262 if (childNode.nodeType === Node.TEXT_NODE) {
4263 textContent += childNode.textContent;
4264 }
4265 }
4266 return textContent;
4267 case HostText:
4268 return fiber.stateNode.textContent;
4269 }
4270
4271 return null;
4272}
4273
4274export function isHiddenSubtree(fiber: Fiber): boolean {
4275 return fiber.tag === HostComponent && fiber.memoizedProps.hidden === true;

Callers 1

matchSelectorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected