wilsonzlin/minify-html

Stripping trailing nbsp is incorrect

clarfonthey opened this issue · 1 comments

Right now, this appears to be stripping all whitespace at the end of a line, when it should be retaining non-breaking spaces, since these actually affect the page layout (in particular, when the text is aligned, since this affects the line length).

For example, the flow text <p>text&nbsp;&nbsp;&nbsp;<br>padding</p> gets minified to <p>text<br>padding</p>, which is especially noticeable if the paragraph is itself center-aligned, since the non-breaking spaces are taken into account for the width.

I'm closing this because it is doing the right behaviour, I just wasn't putting non-breaking spaces when I thought I was.