developit / developit/htm

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

Abierto
#251 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
9k
Forks
181
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

```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?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.