observablehq / htl

A tagged template literal that allows safe interpolation of values into HTML, following the HTML5 spec
https://observablehq.com/@observablehq/htl
ISC License
305 stars 24 forks source link

Unquoted attribute values consume following attributes #38

Closed mootari closed 3 years ago

mootari commented 3 years ago

Given the code:

html`<button title=${"foo"} onclick=${e => {}}>bar`

the resulting HTML is:

<button title="foo&nbsp;onclick=e => {}">bar</button>

Is this the expected behavior?

mootari commented 3 years ago

Works as designed. The space before onclick was a nonbreaking space, accidentally entered via option+space (macOS).