(
parsed: ParsedDocument,
ids: HfId[],
hold: { start: number; end: number; fill: "freeze" | "loop" },
)
| 562 | } |
| 563 | |
| 564 | function handleSetHold( |
| 565 | parsed: ParsedDocument, |
| 566 | ids: HfId[], |
| 567 | hold: { start: number; end: number; fill: "freeze" | "loop" }, |
| 568 | ): MutationResult { |
| 569 | const result: MutationResult = { forward: [], inverse: [] }; |
| 570 | for (const id of ids) { |
| 571 | const el = resolveScoped(parsed.document, id); |
| 572 | if (!el) continue; |
| 573 | |
| 574 | const fields: Array<["start" | "end" | "fill", string]> = [ |
| 575 | ["start", String(hold.start)], |
| 576 | ["end", String(hold.end)], |
| 577 | ["fill", hold.fill], |
| 578 | ]; |
| 579 | |
| 580 | for (const [field, newVal] of fields) { |
| 581 | const attrName = `data-hold-${field}`; |
| 582 | const oldVal = el.getAttribute(attrName); |
| 583 | const path = holdPath(id, field); |
| 584 | el.setAttribute(attrName, newVal); |
| 585 | const p = scalarChange(path, oldVal, newVal); |
| 586 | result.forward.push(p.forward); |
| 587 | result.inverse.push(p.inverse); |
| 588 | } |
| 589 | } |
| 590 | return result; |
| 591 | } |
| 592 | |
| 593 | function handleRemoveElement(parsed: ParsedDocument, ids: HfId[]): MutationResult { |
| 594 | const result: MutationResult = { forward: [], inverse: [] }; |
no test coverage detected