(document: Document, id: string)
| 29 | // ─── Element lookup ─────────────────────────────────────────────────────────── |
| 30 | |
| 31 | export function findById(document: Document, id: string): Element | null { |
| 32 | // Delegate to resolveScoped so patch replay (undo/redo, override-set apply) |
| 33 | // resolves an id the SAME way forward dispatch does: canonical-first for an |
| 34 | // ambiguous bare id, and scoped-path ("hf-host/hf-leaf") aware. Otherwise the |
| 35 | // two paths disagree on which duplicate a bare id targets and undo reverts the |
| 36 | // wrong element. (function declaration is hoisted.) |
| 37 | return resolveScoped(document, id); |
| 38 | } |
| 39 | |
| 40 | export function escapeHfId(id: string): string { |
| 41 | return id.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); |
no test coverage detected