developit / developit/htm

An exception occurred when parsing an unclosed label using htm, but no error was reported.This leads to the wrong virtual dom object

未关闭
#122 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
discussion question
主要语言
JavaScript
星标
9k
派生
181
PR 合并指标
30 天内没有已合并 PR

描述

An exception occurred when parsing an unclosed label using htm, but no error was reported.

This leads to the wrong virtual dom object.

An exception occurred when parsing an unclosed label with "htm", but no error was reported.

This resulted in the wrong "virtual dom" object.

```js
(async () => {
function h(type, props, ...children) {
return {
type,
props,
children
};
}
const {default: htm} = await import('https://unpkg.com/htm?module');
const html = htm.bind(h);
return html;
})().then(html => {
return html`




masx200的github主页-首页









`;
}).then(temp1 => {
console.log(JSON.stringify(temp1, null, 4));
});

```
The 'meta' and 'link' tags above are not closed

The 'meta' and 'link' tags above are not closed

An exception occurred !

```json
[
"meta",
{
"name": "theme-color",
"content": "#ffffff"
},
{
"type": "title",
"props": null,
"children": [
"masx200的github主页-首页"
]
},
{
"type": "script",
"props": {
"nomodule": "",
"src": "https://cdn.jsdelivr.net/gh/masx200/webpack-react-vue-spa-awesome-config@2.4.0/lib/polyfill.min.js"
},
"children": []
},
{
"type": "link",
"props": {
"href": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/main.b9c7ffd191cff11a9b96.css",
"rel": "stylesheet"
},
"children": [
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.6.c2cea2c684fac63ffae0.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.22.ca40a5fe169fbc33ccf0.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.0.1284ce7c8750a8cfed29.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.13.9d669a3554ec48651e33.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.14.64cca74158382392b422.js"
},
"children": []
}
]
}
]
```

The correct output should look like this.

The correct output should look like this.

```json
{
"type": "head",
"props": null,
"children": [
{
"type": "meta",
"props": {
"charset": "utf-8"
},
"children": []
},
{
"type": "meta",
"props": {
"name": "viewport",
"content": "width=device-width,initial-scale=1"
},
"children": []
},
{
"type": "meta",
"props": {
"name": "theme-color",
"content": "#ffffff"
},
"children": []
},
{
"type": "title",
"props": null,
"children": [
"masx200的github主页-首页"
]
},
{
"type": "script",
"props": {
"nomodule": "",
"src": "https://cdn.jsdelivr.net/gh/masx200/webpack-react-vue-spa-awesome-config@2.4.0/lib/polyfill.min.js"
},
"children": []
},
{
"type": "link",
"props": {
"href": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/main.b9c7ffd191cff11a9b96.css",
"rel": "stylesheet"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.6.c2cea2c684fac63ffae0.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.22.ca40a5fe169fbc33ccf0.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.0.1284ce7c8750a8cfed29.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.13.9d669a3554ec48651e33.js"
},
"children": []
},
{
"type": "script",
"props": {
"charset": "utf-8",
"src": "https://cdn.jsdelivr.net/gh/masx200/masx200.github.io@4.3.3/chunk.14.64cca74158382392b422.js"
},
"children": []
}
]
}
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。