nanohtml icon indicating copy to clipboard operation
nanohtml copied to clipboard

implicit/explicit whitespace

Open pekeler opened this issue 7 years ago • 0 comments

When working with a more strict layout, whitespace between elements can cause trouble. For example, if I have a couple of spans that need to be flush against each other, there can't be any whitespace between the span tags in the generated HTML. Unfortunately, bel (or hyperx?) preserves the whitespace from the input.

bel`
  <p>
    <span>one</span>
    <span>two</span>
  </p>
`.toString()

generates:

<p>\n    <span>one</span>\n    <span>two</span>\n  </p>

To work around this issue, I'd have to

bel`
  <p>
    <span>one</span><span>two</span>
  </p>
`.toString()

Which isn't ideal, especially when multiple tags are involved or if they have attributes.

I like the way React deals with this issue: https://facebook.github.io/react/blog/2014/02/20/react-v0.9.html#jsx-whitespace

pekeler avatar Aug 31 '16 19:08 pekeler