developit / developit/htm

  isnt rendering in htm

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

説明

When I have ` ` in htm, it's outputting as literally ` ` in the html.

I've seen some [similar questions for JSX](https://stackoverflow.com/questions/37909134/nbsp-jsx-not-working), but it seems that, even there, the space should render.

Is HTM's not rendering it as a non-breaking space intentional?

Here's a near-simplest case reproduction. Obviously the key is ``render(html`# #`, document.getElementById('root-element'));``. It comes out without a space.

```


Hello, Preact World!



window.render = window.preact.render;
window.html = window.htmPreact.html;

document.addEventListener('DOMContentLoaded', function () {
render(html`# #`, document.getElementById('root-element'));
});



```

![image](https://user-images.githubusercontent.com/104998366/210434911-13275b01-bfaf-46a6-9719-2e07e5d9eb77.png)

(Strangely, if I click "edit html" in Chrome (well, here, Brave), it shows that starts with `&` so, for whatever reason, that `&` is a literal `&` in the render..)

![image](https://user-images.githubusercontent.com/104998366/210435130-a32ce791-a5df-4c21-a2a3-1ad670e97223.png)

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

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

評価

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

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

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