HTMLString
HTMLString copied to clipboard
Element containing only a space (or nbsp) produces no tags
console.log((new HTMLString.String('<span>\u00a0</span>')).html())
// or
console.log((new HTMLString.String('<span> </span>')).html())
Produces:
" "
Expected:
"<span> </span>"
Hi @bfintal, by default whitespace isn't preserved, please see the docs http://getcontenttools.com/api/html-string#string
My guess is that your getting an empty string back because your string is being stripped of spaces.
It is stripped sort of:
console.log((new HTMLString.String('<span> Foo </span>')).html())
Produces:
<span> Foo</span>
Interesting, if I do the following:
s = new window.HTMLString.String(' <span> foo </span>')
This works as expected (<span>foo</span>), but your example above is clearly not the intended output, I'll take a look at this shortly - switching this to bug status.