developit / developit/htm

False arguments serialized as strings

Ouverte
#129 8 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
proposal
Langage dominant
JavaScript
Étoiles
9k
Forks
181
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.