Swaagie / minimize

Minimize HTML
MIT License
162 stars 18 forks source link

[Issue] Keep empty attributes assigned pointless empty value #15

Closed mikehayesuk closed 9 years ago

mikehayesuk commented 9 years ago

When the "keep empty attributes" option is enabled, the compiled HTML actually grows because the attribute is given an empty string value even if it has no value before.

Example, the following:

<div translate>Test</div>

Is compiled to:

<div translate="">Test</div>

The use case that applies here is AngularJS directives, though I'm sure there are other use cases for attributes without a value. The issue was originally raised by @udayms here: https://github.com/jonathanepollack/gulp-minify-html/issues/6

Thanks

Swaagie commented 9 years ago

Thx for reporting, this should not happen indeed. Might be a bit dependant on what htmlparser2 provides but I guess there will be reference to the original value (or undef if not set)