developit / developit/htm

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

オープン
#251 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
9k
フォーク
181
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。