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

[Bug]: <tfoot> tag brokes the structure

Open AngelTs opened this issue 9 months ago • 3 comments

v.4.0.0

AngelTs avatar Apr 13 '25 15:04 AngelTs

Do you have an MRE?

j9t avatar Sep 27 '25 09:09 j9t

Do you have an MRE?

html-minifier in.html -o out.html

<html lang="en"> <head> </head> <body> <table> <tbody> <tr> <td> <table> <caption>000000000000000000000000</caption> <tbody> <tr> <td>11111111111111111111111</td> </tr> <tr> <td>222222222222222222222222</td> </tr> <tr> <td>3333333333333333333333333</td> </tr> </tbody> <tfoot> <tr> <td>99999999999999999999999999999999999</td> </tr> </tfoot> </table> </td> </tr> </tbody> </table> </body> </html>

Will produce out.html with broken valid html structure:

<html lang="en"> <head> </head> <body> <table> <tbody> <tr> <td> <table> <caption>000000000000000000000000</caption> <tbody> <tr> <td>11111111111111111111111</td> </tr> <tr> <td>222222222222222222222222</td> </tr> <tr> <td>3333333333333333333333333</td> </tr> </tbody> </table></td></tr></tbody><tfoot> <tr> <td>99999999999999999999999999999999999</td> </tr> </tfoot> </table> `` </body> </html>

in.html out.html

The same BUG exist and in https://github.com/terser/html-minifier-terser

AngelTs avatar Sep 28 '25 08:09 AngelTs

Thanks @AngelTs! This should be fixed now in version 2.1.5 of HTML Minifier Next—see e.g. the web-based version.

j9t avatar Sep 29 '25 16:09 j9t