MCPcopy
hub / github.com/antonmedv/codejar / visit

Function visit

codejar.ts:479–489  ·  view source on GitHub ↗
(editor: HTMLElement, visitor: (el: Node) => 'stop' | undefined)

Source from the content-addressed store, hash-verified

477 }
478
479 function visit(editor: HTMLElement, visitor: (el: Node) => 'stop' | undefined) {
480 const queue: Node[] = []
481 if (editor.firstChild) queue.push(editor.firstChild)
482 let el = queue.pop()
483 while (el) {
484 if (visitor(el) === 'stop') break
485 if (el.nextSibling) queue.push(el.nextSibling)
486 if (el.firstChild) queue.push(el.firstChild)
487 el = queue.pop()
488 }
489 }
490
491 function isCtrl(event: KeyboardEvent) {
492 return event.metaKey || event.ctrlKey

Callers 2

saveFunction · 0.85
restoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected