developit / developit/htm

html string added in template form treated as string, not html

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

Description

```js
function Carousel(props) {
let images = props.images.split(",");
images.map(image => image.trim());

let mainImage = ``;

let minis = "";
images.forEach(imageUrl => {
minis = minis.concat(``)
})

console.log('a',images,minis)

console.log(html`


`)
}
```

specifically, notice these children:

```

${mainImage}
```

Even though they're identical input, one is converted to a string child, one is converted to a vdom object.

![image](https://github.com/developit/htm/assets/6391152/92347d06-6d46-48ba-93e3-10edac192595)

This is pretty annoying. For something this small, I don't want to create a preact element. I find it weird that this option isn't available. Am I missing something? Why does htm not allow this to be parsed as html but insist on keeping it as a string?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

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