Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collapseWhitespace doesn't fully collapses whitespace between two inputs #834

Closed
EvgenyOrekhov opened this issue Jul 17, 2017 · 7 comments
Closed

Comments

@EvgenyOrekhov
Copy link

minify("<input>    <input>", {collapseWhitespace: true});

Expected: <input><input>
Actual: <input> <input>

HTMLMinifier version: 3.5.2
Node.js version: 8.1.4

@alexlamsl
Copy link
Collaborator

That's working as expected - you may view the result in a web browser to see why that single whitespace is preserved.

@scipper
Copy link

scipper commented Apr 17, 2019

And why is it preserved? I have the same expectation like @EvgenyOrekhov

@EvgenyOrekhov
Copy link
Author

@scipper See https://jsbin.com/tajiwugahe/edit?html Whitespace between <input> tags have the same effect on rendering as whitespace between words.

@scipper
Copy link

scipper commented Apr 17, 2019

does this only apply to <input>? what's the rule behind this behaviour? It still not obvious to me.

@EvgenyOrekhov
Copy link
Author

@scipper A quick googling revealed that this applies to all inline (such as <input>) and inline-block elements.

@scipper
Copy link

scipper commented Apr 17, 2019

Thanks for the explanation! (I wonder what you googled? This information can't be found in the docs or on perfectionkills.com

@EvgenyOrekhov
Copy link
Author

@scipper Based on alexlamsl's comment above, I assumed that the collapseWhitespace option is not intended to alter the behavior of the code, so I googled for the rules of HTML rendering, not for the rules of html-minifier. Something like "html whitespace between elements".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants