False arguments serialized as strings
- 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ả
Suppose use-case for conditional applying classes:
```js
import { render } from "preact";
import { html } from "htm/preact";
let el = document.createElement("div");
render(
html`
`,
el
);
console.log(el.innerHTML);
//
```
[Sandbox](https://codesandbox.io/s/dazzling-margulis-33rhu?fontsize=14)
That's unexpected that the htm serializes false/null class values literally.
That can be worked around with [clsx](https://ghub.io/clsx) or alike, but.
Hướng dẫn đóng góp
Hướng nghiên cứu
Start with the provided CodeSandbox reproduction and trace htm/preact's attribute serialization path for interpolated class values. Confirm the expected handling of false, null, undefined, and "foo", then verify the reproduction no longer emits the unwanted literal values.
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