html-minifier icon indicating copy to clipboard operation
html-minifier copied to clipboard

Should not strip type="text" from <input> tag due to CSS rules needing it

Open danwood opened this issue 4 years ago • 2 comments

Yes, I know that type="text" is the default for an tag, so therefore it should be safe to strip it out.

The problem is when there are css rules that assume that this attribute has not been stripped out.

e.g.

input[type=text], input[type=email], input[type=submit] {
    ...
}

It just seems safer to not strip that out.

danwood avatar Sep 03 '20 18:09 danwood

There is an option for this:

grafik

grafik

https://github.com/kangax/html-minifier#options-quick-reference

Does this work for you? If not please provide a code snippet where this does not resolve your issue.

Alternatively you can tell html-minifier to ignore parts of the code. https://github.com/kangax/html-minifier#ignoring-chunks-of-markup

grafik

DanielRuf avatar Sep 08 '20 13:09 DanielRuf

Changing the default would be a breaking change imho.

DanielRuf avatar Sep 08 '20 13:09 DanielRuf