initial: blog-app snapshot

This commit is contained in:
omo
2026-08-17 17:11:27 +08:00
commit 65cb9d5ead
125 changed files with 14720 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
# escapeHtml parity test (OPT-6 收编验证)
utils.js:38 是 blog-app 唯一一份 escapeHtml 实现.
ai-panel.js 已通过 `import { escapeHtml } from './utils.js'` (line 9) 复用.
无任何本地副本, 无 div.textContent-based 实现.
## 字符集
utils.js:38 escape 5 个字符: `& < > " '`
- `&``&amp;`
- `<``&lt;`
- `>``&gt;`
- `"``&quot;`
- `'``&#39;` (注: 任务 spec 写的是 `&#x27;`, 但 utils.js 用十进制 `&#39;`, 语义等价 — 都是单引号的 HTML entity)
## 测试用例 (行为对齐)
| 输入 | 期望输出 | utils.js 输出 | 一致? |
|---|---|---|---|
| `<script>alert(1)</script>` | `&lt;script&gt;alert(1)&lt;/script&gt;` | 同 | ✓ |
| `a & b` | `a &amp; b` | 同 | ✓ |
| `"quote"` | `&quot;quote&quot;` | 同 | ✓ |
| `'apos'` | `&#39;apos&#39;` | 同 (等价于 `&#x27;`) | ✓ |
| `<img onerror="x">` | `&lt;img onerror=&quot;x&quot;&gt;` | 同 | ✓ |
## 验证命令
grep -nE "function escapeHtml|const escapeHtml" static/js/ai-panel.js
# 预期: 无输出 (本地实现已不存在)
grep -nE "^import.*escapeHtml" static/js/ai-panel.js
# 预期: 9:import { escapeHtml } from './utils.js';
grep -rnE "function escapeHtml|const escapeHtml" static/js/
# 预期: 仅 utils.js:38 一处
## 状态
OPT-6 收编完成 — ai-panel.js 第三份本地实现已不存在.