Skip to content

fix(deps): update dependency html-minifier to v5 - #766

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/html-minifier-5.x
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/html-minifier-5.x

Conversation

@renovate

@renovate renovate Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
html-minifier (source) ^4.0.0 → ^5.0.0 age confidence

Release Notes

j9t/html-minifier (html-minifier)

v5.5.2

Compare Source

Fixed
  • Fixed collapseWhitespace removing line breaks at the end of elements inside pre that had more content after them (thanks @​anthonyeleven)
Changed
  • Made minification faster by detecting duplicate attributes without building a key array, and by looking up entries in the CSS, JavaScript, and SVG minification caches with one map probe instead of two
  • Made parsing documents larger than 20 KB faster by matching attributes in one window of input shared across attributes rather than in a new one for each (except with customAttrAssign or customAttrSurround)

v5.5.1

Compare Source

Fixed
  • Fixed minifyCSS writing CSS escapes it decoded into markup that ends or leaves style elements, which allowed cross-site scripting where pages put untrusted values into CSS-escaped strings (GHSA-82cr-xv6r-xmmx—thanks @​chrisdpurcell)

v5.5.0

Compare Source

Fixed
  • Fixed the CLI reporting an unchanged input as saving “-0” bytes
Added
  • Added countTokens(), which counts the tokens text takes in OpenAI’s o200k_base encoding (GPT-4o and later) exactly as tiktoken does, to measure what minification saves in LLM tokens; the vocabulary (about 2 MB) ships with HM and loads on first use
  • Added --tokens (-t) to the CLI, which adds token savings to the statistics it reports
  • Added the change in bytes to the summary the CLI ends directory runs with, and in tokens with --tokens (“Processed 114 files: -5,237,021 bytes (-12.8%) · -1,493,175 LLM tokens (-11.2%)”)
  • Added token savings to the web version’s status line, counted on calculate, which loads the vocabulary, and from then on with each result
Changed
  • Changed the web version to report sizes in bytes rather than characters, and the change rather than savings (“Change: -4 bytes (-26.7%)” rather than “savings: 4 bytes (26.67%)”)
  • Changed the CLI to end directory runs with that summary outside terminals, too (e.g., in CI)
  • Changed the CLI to sign percentages like the amounts they belong to, minus for what shrank (“1,234 → 892 bytes (-342, -27.7%)”), and to report a dry run’s result as “Change” rather than “Saved” (“Change: -342 bytes (-27.7%)” rather than “Saved: -342 bytes (27.7%)”)
  • Changed the CLI to show percentages without trailing zeros (e.g., “25%” rather than “25.0%”) and to set off the list of files it could not process with a blank line

v5.4.2

Compare Source

Fixed
  • Fixed removeEmptyElements with collapseWhitespace dropping the space after an empty inline element it removes right after an element that doesn’t render, like a non-empty script (e.g., <p>a<script>1</script><span></span> b</p> became <p>a<script>1</script>b</p>)
  • Fixed collapseWhitespace keeping whitespace next to htmlmin:ignore blocks that start or end with whitespace, which doubled it and changed the output when minified again (e.g., a <!-- htmlmin:ignore --> x <!-- htmlmin:ignore --> b became a x b), including at the edges of partialMarkup and, under trimCustomFragments, next to custom fragments
  • Fixed minifySVG dropping htmlmin:ignore markup within svg elements, along with the markers (e.g., <svg><!-- htmlmin:ignore --><g id="a"></g><!-- htmlmin:ignore --></svg> became <svg/>); such svg elements now skip SVGO

v5.4.1

Compare Source

Fixed
  • Fixed minifyJS breaking scripts where a custom fragment starts a statement after a label or case the fragment check missed—after a template literal holding a backtick (var s = `${"`"}`; l: <?= $x ?>; became var s="`";b(), <?= $x ?>), after a label with a non-ASCII name, and after a label within a block (switch (a) { case 1: { l: <?= $x ?> } })—by parsing JavaScript with Acorn rather than reading it by hand
  • Fixed minifyCSS and minifyJS changing the quotes around custom fragments in strings; such code now stays as written
  • Fixed minifyJS doubling whitespace next to custom fragments in strings that Terser escapes (e.g., a tab before <?= $x ?> in a string became \t and the tab)
  • Fixed minifyJS rewriting escapes right before custom fragments in strings into ones the rendered fragment could extend ("\x00<?= $x ?>" became "\0<?= $x ?>", which reads differently before a digit); such code now stays as written
  • Fixed minifyCSS and minifyJS reordering custom fragments, which changes the order template code runs in; such code now stays as written
  • Fixed minifyCSS reading escaped quotes (x\") as the start of a string when checking custom fragments
Changed
  • Made minification faster by checking short attribute and class lists for repeats without building a set
  • Changed the backtest’s user agent to html-minifier-backtest (+https://github.com/j9t/html-minifier/tree/main/backtest), dropping the placeholder version and adding a URL

v5.4.0

Compare Source

Fixed
  • Fixed partialMarkup failing on a stray </svg> or </math> end tag (e.g., </svg><svg><rect/></svg> threw “Cannot read properties of undefined”)
Changed
  • Changed collapseWhitespace to keep whitespace at either end of partialMarkup fragments as a single space (or line break, with preserveLineBreaks) where it may separate the fragment from what surrounds it, as next to text, inline elements, and elements that don’t render (previously, <b>Jane</b>\n became <b>Jane</b>, and a <link rel="x"> became a<link rel="x">), while it still goes next to block elements
  • Made pages with inline SVG or MathML faster to minify, as the first svg or math element slowed down the minification of the rest of the page (by 10–20% on pages without much SVG or MathML)

v5.3.1

Compare Source

Fixed
  • Fixed </form> closing the elements open in the form, which browsers leave open (e.g., <form><div></form>x</div>y became <form><div></form>xy), and closing elements beyond a scope boundary, where browsers ignore it (e.g., in a table cell, which lost the </table> that followed)
  • Fixed collapseWhitespace removing spaces that separate text around elements that don’t render (like script and link) when custom fragments, comments, or elements removed by removeComments or removeEmptyElements follow them (e.g., a <script></script><!--c-->b became a<script></script><!--c-->b, and <p>a<script></script> <script></script> <script></script>b</p> with removeEmptyElements became <p>ab</p>)
  • Fixed removeEmptyElements with collapseWhitespace dropping the space before or after an empty block element it removes (e.g., <div>a <div></div>b</div> and <div>a<div></div> b</div> became <div>ab</div>)

v5.3.0

Compare Source

Changed
  • Removed useShortDoctype from the conservative preset, as it converts any doctype to the short HTML doctype (which switches pages with legacy doctypes—e.g., HTML 4.01 Transitional—to standards mode and can change how they render); to keep the previous behavior, add useShortDoctype (e.g., --preset=conservative --use-short-doctype)

v5.2.0

Compare Source

Fixed
  • Fixed collapseAttributeWhitespace adding spaces around custom fragments in attribute values (e.g., href="/invoices/<?= $inv->id ?>?tab=lines" became href="/invoices/ <?= $inv->id ?> ?tab=lines")
Added
  • Added a preview of zero-config mode with --zero --dry, or --dry without input (which used to wait silently for input)
Changed
  • Made the CLI say how to end input, and how to minify files instead, when it reads from STDIN in a terminal
  • Made --dry and --verbose suggest --preset=comprehensive when no minification options are set

v5.1.0

Compare Source

Fixed
  • Fixed removeUnusedCSS keeping style sheets of which nothing is used as written, unminified, where they held a word of ten or more lowercase letters (e.g., background; taken for a custom-fragment placeholder)
  • Fixed mergeScripts merging what only looks like scripts—text in textarea and title elements, comments, and markup kept with htmlmin:ignore—and losing code where a script holds <!--<script>, which browsers end only at a later </script> (e.g., <script><!--<script></script><script></script></script> lost <script></script>)
  • Fixed mergeScripts joining a script that ends in a custom fragment on one line with the next, which the fragment may comment out
  • Fixed mergeScripts merging scripts that start with a hashbang (#!), which only works at the very start of a script, so that none of the merged code ran
  • Fixed mergeScripts dropping the attributes of scripts merged into another, whose own attributes then covered their code, too—which tools that rewrite pages in the browser or at the edge read (e.g., data-cfasync="false" for Cloudflare Rocket Loader, or data-cookieconsent)—scripts now merge only where their attributes match (other than a JavaScript type), and not where they have an id
  • Fixed removeDefaultTypeAttributes removing JavaScript types with parameters (e.g., type="text/javascript; charset=utf-8"), which make the element a data block rather than a script, so that browsers then ran its content; minifyJS no longer minifies such blocks, either
Added
  • Added mergeStyles (part of the comprehensive preset) to merge consecutive style elements with compatible style sheets into one, which minifyCSS then minifies as one (e.g., <style>a{color:red}</style><style>a{color:blue}</style> becomes <style>a{color:#&#8203;00f}</style>)
Changed
  • Made mergeScripts faster, as it merges what the minifier writes rather than scanning its output again
  • Made mergeScripts merge scripts of any JavaScript type (e.g., text/ecmascript), not just of text/javascript and application/javascript
  • Made minifyJS, removeDefaultTypeAttributes, and mergeScripts treat the remaining JavaScript types browsers run as such (text/javascript1.0 to text/javascript1.5, and text/livescript)

v5.0.4

Compare Source

Fixed
  • Fixed collapseWhitespace taking quadratic time on deeply nested markup, as each end tag walked back over all those before it (e.g., 6,400 nested div elements took 1.5 s rather than 7 ms)
  • Fixed mergeScripts joining scripts on one line after a last line holding <!-- or -->, which browsers read as starting a comment, so that the next script didn’t run (e.g., a()\n<!--b--> before c())
  • Fixed mergeScripts merging a script holding <!-- with one holding <script, which browsers then didn’t end at </script>, so that the rest of the document became script text (e.g., a="<!--" before b="<script>")
  • Fixed mergeScripts joining a script that starts with --> on the line before it, where browsers no longer read it as a comment, which broke the merged script (e.g., a() before -->b)
  • Fixed removeOptionalTags omitting </li>, </dd>, and </dt> before end tags that don’t close these elements in browsers, which moved what follows into them (e.g., <span><li>a</li></span><li>b)
  • Fixed minifySVG removing whitespace from HTML in foreignObject elements, which joined words (e.g., <p>a <b>b</b> c</p> rendered as “abc”)
  • Fixed minifyJS turning NUL characters in scripts into \0, where browsers read U+FFFD
  • Fixed collapseAttributeWhitespace trimming the encoding of annotation-xml elements, which browsers match as written, so that the element came to hold HTML rather than MathML (e.g., encoding=" text/html ")
  • Fixed collapseWhitespace removing spaces around marquee elements, which browsers render as inline blocks (e.g., a <marquee>b</marquee> c)
  • Fixed removeEmptyElements with removeEmptyAttributes keeping empty elements whose only reason to stay was an empty id that then got removed (e.g., <div id=""></div> became <div></div>)
  • Fixed removeUnusedCSS keeping rules for elements whose names match only where non-ASCII letters are lowercased, which browsers don’t do (e.g., kbd rules for <\u212Abd>, written with a Kelvin sign)
Changed
  • Made sortAttributes and sortClassNames faster by not running CSS, JavaScript, JSON, SVG, and URL minification in their analysis pass, which only counts attributes and classes
  • Made removeUnusedCSS faster at collecting the classes and IDs a document uses
  • Made each minify call faster by reusing attribute and ignoreCustomFragments patterns across calls
  • Documented how SWC compares to Terser for JavaScript minification

v5.0.3

Compare Source

Fixed
  • Fixed mergeScripts joining scripts with only a newline after a last line holding // (as in a URL), which made the next script a call where it starts with ( or [ (e.g., a="https://b" before (c)())
  • Fixed collapseWhitespace removing spaces that render:
    • after an inline element holding only an image, SVG, or other replaced content (e.g., <a><img></a> text)
    • within bdi, bdo, cite, code, dfn, label, q, and ruby elements next to text (e.g., a<code> b</code>)
    • after self-closed svg and math elements, after a no-break space, around end tags that get dropped, and before removed comments next to text
  • Fixed scripts holding <!-- <script>…</script> -->, which browsers end only at a later </script>: The real end tag was dropped, which made the rest of the document script text
  • Fixed removeEmptyElements with removeOptionalTags mishandling what surrounds removed elements:
    • deleting the element before an empty body (e.g., a script or title)
    • leaving a tag omitted because of an element that then got removed (e.g., <a><p>b</p><footer></footer></a> lost </p>, and without a body start tag before a removed element, a following script moved to the head)
  • Fixed removeEmptyElements removing an element that closes another one with no end tag, which moved what follows into that other element (e.g., <p>a<div></div>b became <p>ab)
  • Fixed removeEmptyElements removing empty html, head, and body elements with attributes, which browsers don’t recreate (e.g., <body class="a"></body>), and frameset elements, without which browsers render what follows
  • Fixed removeRedundantAttributes, removeDefaultTypeAttributes, and removeEmptyAttributes removing attributes that a style element in the document selects on (e.g., type given input[type=text])
  • Fixed removeRedundantAttributes removing name from a elements with a different id, which broke links to the name
  • Fixed collapseWhitespace removing a trailing newline from textarea elements, which is part of their value
  • Fixed comments not ending at --!>, and <!--> and <!---> not being read as empty comments—with removeComments, content up to the next --> was deleted
  • Fixed end tags browsers read differently from the parser, which moved or merged content:
    • </tr> and </tbody> closing rows and sections that only have implied start tags were dropped, merging table rows
    • tr and section start tags didn’t close an implied cell, which removeEmptyElements saw as emptying the row
    • End tags of table parts reached outside their own table
    • End tags of formatting elements closed block elements inside them (e.g., <a><div></a>x</div>), and weren’t ignored from within a table when the element is outside it
    • End tags of ordinary elements weren’t ignored with a block element open inside them (e.g., <span><div></span>x</div>)
    • End tags weren’t ignored with an element open inside that ends their scope, such as a table or, for li, a list (e.g., <li><ul></li></ul>x lost </ul>)
  • Fixed whitespace handling and removeEmptyElements losing track of what is open after the end tag of a formatting element with a block element open inside it (e.g., <pre><b><p></b>a</p></pre> kept whitespace after it, and <b><p></b></p>x lost </b>)
  • Fixed whitespace being collapsed within doctype identifiers, which changed them and could change the document mode (e.g., PUBLIC "a b")
  • Fixed doctypes that browsers ignore after a tag or another doctype staying in the output, where removeOptionalTags could leave one first and have it set the document mode (e.g., <body></body><!doctype html>)
  • Fixed removeOptionalTags omitting the body start tag before base, basefont, bgsound, noframes, and title elements, which moved them to the head
  • Fixed minifyCSS emptying invalid media queries, which made the style sheet apply (e.g., media="only screen and 8px)")
  • Fixed quotes running into an attribute name being dropped with the value before them, which turned <a href="x""target="_blank"> into a real target attribute—such a tag is now a parse error, and with continueOnParseError keeps its "target attribute
  • Fixed continueOnParseError turning tags with quotes in attribute names into text (e.g., <img alt="a "b" c">, with decodeEntities, became &lt;img…)
  • Fixed CDATA sections directly in svg and math elements being read as comments, svg elements in annotation-xml being read as MathML, and isindex being read as a void element
Added
  • Added a development-only check that minified output means the same to browsers as its source: npm test compares parse5 trees and rendered whitespace across option combinations, generated markup, and html5lib’s parser tests, and npm run test:equivalence does so for the real-world corpus
Changed
  • Made CLI directory runs (--input-dir, --zero) skip and report a file that fails rather than stop at it; a run with failures ends by listing the files and exits with code 1

v5.0.2

Compare Source

Fixed
  • Fixed minifyCSS and minifyJS deleting or breaking custom fragments that start a rule or statement, follow a case clause or label, or sit in an @charset, @import, or @namespace statement that would be dropped with them—CSS and JavaScript with such a fragment are now kept as written:
    • <style>b { top: 0 }\n<?php echo 1; ?></style> lost the PHP block
    • <style>a { top: 0 }\n<?php echo 1; ?>\nb { top: 0 }</style> had its rules merged across the fragment
    • <script>b()\n<?php if (x): ?>\nc()\n<?php endif; ?>\nd()</script> became a syntax error when the condition was false
    • <style>@import <?= $u ?>;a{top:0}</style> lost the at-rule and the fragment
    • <script>switch (a) { case 1: <?= $x ?> }</script> became if(1===a) <?= $x ?>, which is wrong if the fragment renders several statements
    • <script>l: <?= $x ?>;</script> lost the label
  • Fixed collapseBooleanAttributes turning hidden="until-found" into hidden, which made the content unfindable
  • Fixed collapseBooleanAttributes removing values that hold a custom fragment or htmlmin:ignore markup, which deleted template code (e.g., checked="<?= $c ?>"), and hidden and draggable values that hold a character reference, where only decoding shows the state
  • Fixed collapseBooleanAttributes removing the loop count of marquee elements (<marquee loop="3"> became <marquee loop>, which loops forever) and the values of attributes in SVG and MathML, where HTML’s Boolean attributes don’t apply (e.g., <mfenced open="["> lost its delimiter)
  • Fixed collapseWhitespace removing spaces around and within SVG tspan and textPath elements, which joined words (e.g., a <tspan>b</tspan> became a<tspan>b</tspan>)
  • Fixed collapseWhitespace collapsing whitespace within SVG script and style elements written in uppercase, which could break their code (e.g., a line comment in <svg><SCRIPT> swallowed the next line)
  • Fixed collapseBooleanAttributes not collapsing alpha, headingreset, nomodule, playsinline, shadowrootclonable, shadowrootcustomelementregistry, shadowrootdelegatesfocus, and shadowrootserializable
  • Fixed collapseBooleanAttributes removing the values of defaultchecked, defaultmuted, defaultselected, enabled, indeterminate, pauseonexit, and visible, none of which are HTML attributes (e.g., <my-widget visible="false"> became <my-widget visible>)
Changed
  • Made collapseBooleanAttributes leave custom elements alone, as these define what their attributes mean (e.g., <my-toggle checked="false"> keeps its value)
  • Made the CLI show the help when run in a terminal without any arguments, rather than waiting for input

v5.0.1

Compare Source

Fixed
  • Fixed two regular expression denial-of-service (ReDoS) issues (GHSA-9wmg-23wv-h297—thanks @​aweiaaaaa), each causing quadratic (O(n²)) backtracking on the minify() path, now replaced by linear-time scans

v5.0.0

Compare Source

Fixed
  • Fixed decodeEntities (and minifyJS, in event handler attributes) turning an escaped ampersand into one that starts a character reference, which changed the value browsers read (e.g., title="&amp;copy b" → title="&copy b", read as “© b,” now kept; and in text, &amp;#&#8203;169 → &#&#8203;169, now &amp#169)
  • Fixed decodeEntities (and minifyJS, in event handler attributes) leaving character references without a semicolon in attributes undecoded where browsers decode them (e.g., title="&copy b", now title="© b")
Changed

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/html-minifier-5.x branch 5 times, most recently from 9b3f86b to e1940c4 Compare November 11, 2026 18:38
@renovate
renovate Bot force-pushed the renovate/html-minifier-5.x branch 7 times, most recently from 9cae890 to b4ea540 Compare November 18, 2026 16:07
@renovate
renovate Bot force-pushed the renovate/html-minifier-5.x branch 8 times, most recently from 44e5917 to 0c99d85 Compare November 27, 2026 01:40
@renovate
renovate Bot force-pushed the renovate/html-minifier-5.x branch 10 times, most recently from 78fb4c0 to 09fea69 Compare December 4, 2026 13:50
@renovate
renovate Bot force-pushed the renovate/html-minifier-5.x branch from 09fea69 to 22ed029 Compare December 4, 2026 19:52
@renovate
renovate Bot force-pushed the renovate/html-minifier-5.x branch from 22ed029 to 0a90498 Compare December 5, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants