ivi
ivi copied to clipboard
@ivi/htm: whitespace between dynamic bits disappears
@localvoid
`
${table.schema.cols.map((c, i) => html`
<th @click=${() => onClickCol(i)}>
${c.name}
${sortDir[i] || ''}
${sortPos[i] || ''}
</th>
`)}
`
creates 3 adjacent text nodes with no white space between:
<th>genre11</th>
also behaves a bit differently when in single line:
`
${table.schema.cols.map((c, i) => html`
<th @click=${() => onClickCol(i)}>${c.name} ${sortDir[i] || ''} ${sortPos[i] || ''}</th>
`)}
`
<th>title <!---->11</th>
inserting
in between doesn't quite work, either:
`
${table.schema.cols.map((c, i) => html`
<th @click=${() => onClickCol(i)}>
${c.name}
${sortDir[i] || ''}
${sortPos[i] || ''}
</th>
`)}
`
<th>genre <!---->11</th>
@localvoid any chance of getting this patched?
I'll try to figure out what causing this issue and fix it next week, but I am not sure that I'll have a lot of time to work on this project.
I'll try to figure out what causing this issue and fix it next week
thanks :)
but I am not sure that I'll have a lot of time to work on this project.
that's too bad :(, but i get it.
@localvoid ping :pray:
Released a new version that should fix the bug with a comment node.
The first example with newlines works as expected, by default all whitespaces around newlines between elements and expressions are removed (https://github.com/localvoid/ivi/blob/master/packages/@ivi/htm/README.md#whitespaces). There is a workaround with vertical tab \v
for such use cases:
`
${table.schema.cols.map((c, i) => html`
<th @click=${() => onClickCol(i)}>
${c.name}
\v${sortDir[i] || ''}
\v${sortPos[i] || ''}
</th>
`)}
`
thanks!