developit / developit/htm

Improve runtime error handling for missing close tags

Đang mở
#166 5 bình luận 1 reaction 0 người được giao Xem trên GitHub
debugging duplicate enhancement proposal
Ngôn ngữ chính
JavaScript
Star
9k
Fork
181
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by running the provided tagged-template sample with the htm runtime and reproduce how the missing is handled. Trace the parser path for an unclosed tag; done means the sample throws an exception instead of treating the element name as a text node, while valid tags continue to produce the expected object.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.