Improve runtime error handling for missing close tags
未關閉
debugging
duplicate
enhancement
proposal
- 主要語言
- JavaScript
- 星號
- 9k
- 分支
- 181
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Consider this sample code, which accidentally omits a closing tag.
```js
import htm from 'https://unpkg.com/htm?module'
const h = (type, props, ...children) => ({type, props, children});
const html = htm.bind(h)
console.log(JSON.stringify(html`
Hello, world!`));
```
In this case, the user intended to include a closing tag ``, and so the user's desired logged result is `{"type":"h1","props":null,"children":["Hello, world!"]}`
Actual: `["h1","Hello, world!"]` The element name is incorrectly handled as a text node.
Expected: Throw an exception.
貢獻指南
研究方向
首先使用 htm runtime 執行提供的 tagged-template sample,並重現缺少的 是如何被處理的。追蹤未閉合標籤的 parser 路徑;完成的標準是 sample 拋出 exception,而不是將元素名稱當作文字節點處理,同時有效標籤仍繼續產生預期的物件。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- frontend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100