(node?: DOMNode)
| 391 | * Also marks yoga dirty for text remeasurement if this is a text node. |
| 392 | */ |
| 393 | export const markDirty = (node?: DOMNode): void => { |
| 394 | let current: DOMNode | undefined = node |
| 395 | let markedYoga = false |
| 396 | |
| 397 | while (current) { |
| 398 | if (current.nodeName !== '#text') { |
| 399 | ;(current as DOMElement).dirty = true |
| 400 | // Only mark yoga dirty on leaf nodes that have measure functions |
| 401 | if ( |
| 402 | !markedYoga && |
| 403 | (current.nodeName === 'ink-text' || |
| 404 | current.nodeName === 'ink-raw-ansi') && |
| 405 | current.yogaNode |
| 406 | ) { |
| 407 | current.yogaNode.markDirty() |
| 408 | markedYoga = true |
| 409 | } |
| 410 | } |
| 411 | current = current.parentNode |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | // Walk to root and call its onRender (the throttled scheduleRender). Use for |
| 416 | // DOM-level mutations (scrollTop changes) that should trigger an Ink frame |
no test coverage detected