developit / developit/htm

Trimming newlines near elements

未关闭
#253 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
9k
派生
181
PR 合并指标
30 天内没有已合并 PR

描述

When running the following code:
```javascript
import htm from 'https://unpkg.com/htm?module'

function h(type, props, ...children) {
return { type, props, children };
}

const html = htm.bind(h);

console.log( html`


bold
regular
` );
```
I am getting the following object:
```javascript
{
type: 'div',
props: null,
children: [{type: 'b' /* , ... */}, 'regular']
}
```
The string have been auto-formatted but still seems to be a valid HTML code. Now I have implemented my own `h()` function as I'd like to compose the DOM elements in my way. However, I don't see any obvious way to split `bold` and `regular` elements with a space except for inserting ` ` (#234). I'd appreciate any comments on this.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。