| 4251 | } |
| 4252 | |
| 4253 | export 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 | |
| 4274 | export function isHiddenSubtree(fiber: Fiber): boolean { |
| 4275 | return fiber.tag === HostComponent && fiber.memoizedProps.hidden === true; |