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

removal of unrequired end tags leaves empty newline #442

Closed
esdnm opened this issue Sep 19, 2021 · 3 comments
Closed

removal of unrequired end tags leaves empty newline #442

esdnm opened this issue Sep 19, 2021 · 3 comments

Comments

@esdnm
Copy link

esdnm commented Sep 19, 2021

using minify --html-keep-whitespace on

<h1>h1</h1>
<ul>
<li>this is a list.
more things.
</li>
<li>one more
item.
</li>
</ul>

produces,

<h1>h1</h1>
<ul>
<li>this is a list.
more things.

<li>one more
item.

</ul>

should those empty newlines be there?

@tdewolff
Copy link
Owner

Should be fixed now, please let me know if you have any further problems!

@esdnm
Copy link
Author

esdnm commented Sep 21, 2021

Should be fixed now, please let me know if you have any further problems!

Thanks!

I currently don't have any further problems. But! I am little surprised by the commit. You flipped the branches and It works. I would like to know what has happened.

@tdewolff
Copy link
Owner

Hehe I had to take a second look as well. The fact is that o.KeepWhitespace = true and would initially always result in setting omitSpace = false. By reordering however, we first check whether this is a block closing tag, if so set omitSpace = true and otherwise to false. This creates more instances where omitSpace is true that was previously the case, namely after closing tags for blocks.

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

2 participants