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

[Bug]: Remove redundant attributes should support <img> loading attribute

Open gmarty opened this issue 2 years ago • 1 comments

What happened?

The default value for the lazy loading attribute of the <img> tag is "eager". See the spec.

The following htnl:

<img src="logo.jpg" alt="Our logo" loading="eager">

should be minified like this when removeRedundantAttributes is set to true:

<img src="logo.jpg" alt="Our logo">

I haven't checked, but I suspect there are a lot more default attributes that could be supported but aren't currently. Basically all enumerated attributes according to the spec should have their default value added to the minifier.

Version

7.2.0

What browsers are you seeing the problem on?

No response

Link to reproduce

No response

Relevant log output

No response

Willing to submit a PR?

Yes

gmarty avatar Oct 12 '23 22:10 gmarty

Thanks for reporting this. Feel free to provide a PR.

DanielRuf avatar Nov 02 '24 11:11 DanielRuf