HTML minification removes type="text" attributes and breaks CSS attribute selectors
HTML minification removes type="text" attributes and breaks CSS attribute selectors
The minifier removes explicit type="text" attributes from HTML input elements because text is the default input type.
However, this can change the behaviour of CSS when attribute selectors are used.
Example:
Original HTML:
<input type="text" id="location">
Minified HTML:
<input id=location>
CSS:
.opt input {
width: 20px;
}
.settings-section input[type=text] {
width: 150px;
}
In the original HTML, the second CSS rule matches and the input is 150px wide.
After minification, input[type=text] no longer matches because the type attribute has been removed. The input therefore becomes only 20px wide.
Although omitting type="text" is technically equivalent in HTML input behaviour, it is not equivalent when CSS attribute selectors depend on that attribute.
Expected behaviour: The minifier should preserve attributes referenced by CSS selectors, or provide an option to disable this particular attribute removal.