Files
q-edit/docs/adr/0004-ui-render-helper.md
2025-09-02 21:04:17 -04:00

720 B

ADR 0004 — UI render helper (escape + tagged templates + fragment + renderInto)

Date: 2025-09-02

Context

We want a tiny rendering utility with safe defaults (escaped HTML), raw opt-in, and convenient DOM insertion—without introducing a framework or build step.

Decision

  • Add src/ui/render.js providing:
    • escapeHtml, raw, html (tagged template), fragment, and renderInto.
  • Cover with unit tests in tests/ui.render.test.mjs.
  • Keep adoption optional and incremental; usage can be introduced in script.js at low risk.

Consequences

  • Safer string rendering out of the box; clear opt-in for trusted HTML only.
  • Simple, testable building block as we gradually refactor UI code.