Repository navigation
fix(deps): update dependency html-minifier to v5 - #766
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/html-minifier-5.x
branch
5 times, most recently
from
November 11, 2026 18:38
9b3f86b to
e1940c4
Compare
renovate
Bot
force-pushed
the
renovate/html-minifier-5.x
branch
7 times, most recently
from
November 18, 2026 16:07
9cae890 to
b4ea540
Compare
renovate
Bot
force-pushed
the
renovate/html-minifier-5.x
branch
8 times, most recently
from
November 27, 2026 01:40
44e5917 to
0c99d85
Compare
renovate
Bot
force-pushed
the
renovate/html-minifier-5.x
branch
10 times, most recently
from
December 4, 2026 13:50
78fb4c0 to
09fea69
Compare
renovate
Bot
force-pushed
the
renovate/html-minifier-5.x
branch
from
December 4, 2026 19:52
09fea69 to
22ed029
Compare
renovate
Bot
force-pushed
the
renovate/html-minifier-5.x
branch
from
December 5, 2026 02:28
22ed029 to
0a90498
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^4.0.0→^5.0.0Release Notes
j9t/html-minifier (html-minifier)
v5.5.2Compare Source
Fixed
collapseWhitespaceremoving line breaks at the end of elements insideprethat had more content after them (thanks @anthonyeleven)Changed
customAttrAssignorcustomAttrSurround)v5.5.1Compare Source
Fixed
minifyCSSwriting CSS escapes it decoded into markup that ends or leavesstyleelements, which allowed cross-site scripting where pages put untrusted values into CSS-escaped strings (GHSA-82cr-xv6r-xmmx—thanks @chrisdpurcell)v5.5.0Compare Source
Fixed
Added
countTokens(), which counts the tokens text takes in OpenAI’so200k_baseencoding (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--tokens(-t) to the CLI, which adds token savings to the statistics it reports--tokens(“Processed 114 files: -5,237,021 bytes (-12.8%) · -1,493,175 LLM tokens (-11.2%)”)Changed
v5.4.2Compare Source
Fixed
removeEmptyElementswithcollapseWhitespacedropping the space after an empty inline element it removes right after an element that doesn’t render, like a non-emptyscript(e.g.,<p>a<script>1</script><span></span> b</p>became<p>a<script>1</script>b</p>)collapseWhitespacekeeping whitespace next tohtmlmin:ignoreblocks that start or end with whitespace, which doubled it and changed the output when minified again (e.g.,a <!-- htmlmin:ignore --> x <!-- htmlmin:ignore --> bbecamea x b), including at the edges ofpartialMarkupand, undertrimCustomFragments, next to custom fragmentsminifySVGdroppinghtmlmin:ignoremarkup withinsvgelements, along with the markers (e.g.,<svg><!-- htmlmin:ignore --><g id="a"></g><!-- htmlmin:ignore --></svg>became<svg/>); suchsvgelements now skip SVGOv5.4.1Compare Source
Fixed
minifyJSbreaking scripts where a custom fragment starts a statement after a label orcasethe fragment check missed—after a template literal holding a backtick (var s = `${"`"}`; l: <?= $x ?>;becamevar 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 handminifyCSSandminifyJSchanging the quotes around custom fragments in strings; such code now stays as writtenminifyJSdoubling whitespace next to custom fragments in strings that Terser escapes (e.g., a tab before<?= $x ?>in a string became\tand the tab)minifyJSrewriting 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 writtenminifyCSSandminifyJSreordering custom fragments, which changes the order template code runs in; such code now stays as writtenminifyCSSreading escaped quotes (x\") as the start of a string when checking custom fragmentsChanged
html-minifier-backtest (+https://github.com/j9t/html-minifier/tree/main/backtest), dropping the placeholder version and adding a URLv5.4.0Compare Source
Fixed
partialMarkupfailing on a stray</svg>or</math>end tag (e.g.,</svg><svg><rect/></svg>threw “Cannot read properties of undefined”)Changed
collapseWhitespaceto keep whitespace at either end ofpartialMarkupfragments as a single space (or line break, withpreserveLineBreaks) 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>\nbecame<b>Jane</b>, anda <link rel="x">becamea<link rel="x">), while it still goes next to block elementssvgormathelement slowed down the minification of the rest of the page (by 10–20% on pages without much SVG or MathML)v5.3.1Compare Source
Fixed
</form>closing the elements open in the form, which browsers leave open (e.g.,<form><div></form>x</div>ybecame<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)collapseWhitespaceremoving spaces that separate text around elements that don’t render (likescriptandlink) when custom fragments, comments, or elements removed byremoveCommentsorremoveEmptyElementsfollow them (e.g.,a <script></script><!--c-->bbecamea<script></script><!--c-->b, and<p>a<script></script> <script></script> <script></script>b</p>withremoveEmptyElementsbecame<p>ab</p>)removeEmptyElementswithcollapseWhitespacedropping 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.0Compare Source
Changed
useShortDoctypefrom theconservativepreset, 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, adduseShortDoctype(e.g.,--preset=conservative --use-short-doctype)v5.2.0Compare Source
Fixed
collapseAttributeWhitespaceadding spaces around custom fragments in attribute values (e.g.,href="/invoices/<?= $inv->id ?>?tab=lines"becamehref="/invoices/ <?= $inv->id ?> ?tab=lines")Added
--zero --dry, or--drywithout input (which used to wait silently for input)Changed
--dryand--verbosesuggest--preset=comprehensivewhen no minification options are setv5.1.0Compare Source
Fixed
removeUnusedCSSkeeping 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)mergeScriptsmerging what only looks like scripts—text intextareaandtitleelements, comments, and markup kept withhtmlmin: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>)mergeScriptsjoining a script that ends in a custom fragment on one line with the next, which the fragment may comment outmergeScriptsmerging scripts that start with a hashbang (#!), which only works at the very start of a script, so that none of the merged code ranmergeScriptsdropping 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, ordata-cookieconsent)—scripts now merge only where their attributes match (other than a JavaScripttype), and not where they have anidremoveDefaultTypeAttributesremoving 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;minifyJSno longer minifies such blocks, eitherAdded
mergeStyles(part of thecomprehensivepreset) to merge consecutivestyleelements with compatible style sheets into one, whichminifyCSSthen minifies as one (e.g.,<style>a{color:red}</style><style>a{color:blue}</style>becomes<style>a{color:#​00f}</style>)Changed
mergeScriptsfaster, as it merges what the minifier writes rather than scanning its output againmergeScriptsmerge scripts of any JavaScript type (e.g.,text/ecmascript), not just oftext/javascriptandapplication/javascriptminifyJS,removeDefaultTypeAttributes, andmergeScriptstreat the remaining JavaScript types browsers run as such (text/javascript1.0totext/javascript1.5, andtext/livescript)v5.0.4Compare Source
Fixed
collapseWhitespacetaking quadratic time on deeply nested markup, as each end tag walked back over all those before it (e.g., 6,400 nesteddivelements took 1.5 s rather than 7 ms)mergeScriptsjoining 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-->beforec())mergeScriptsmerging 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="<!--"beforeb="<script>")mergeScriptsjoining 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)removeOptionalTagsomitting</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)minifySVGremoving whitespace from HTML inforeignObjectelements, which joined words (e.g.,<p>a <b>b</b> c</p>rendered as “abc”)minifyJSturningNULcharacters in scripts into\0, where browsers readU+FFFDcollapseAttributeWhitespacetrimming theencodingofannotation-xmlelements, which browsers match as written, so that the element came to hold HTML rather than MathML (e.g.,encoding=" text/html ")collapseWhitespaceremoving spaces aroundmarqueeelements, which browsers render as inline blocks (e.g.,a <marquee>b</marquee> c)removeEmptyElementswithremoveEmptyAttributeskeeping empty elements whose only reason to stay was an emptyidthat then got removed (e.g.,<div id=""></div>became<div></div>)removeUnusedCSSkeeping rules for elements whose names match only where non-ASCII letters are lowercased, which browsers don’t do (e.g.,kbdrules for<\u212Abd>, written with a Kelvin sign)Changed
sortAttributesandsortClassNamesfaster by not running CSS, JavaScript, JSON, SVG, and URL minification in their analysis pass, which only counts attributes and classesremoveUnusedCSSfaster at collecting the classes and IDs a document usesminifycall faster by reusing attribute andignoreCustomFragmentspatterns across callsv5.0.3Compare Source
Fixed
mergeScriptsjoining 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)())collapseWhitespaceremoving spaces that render:<a><img></a> text)bdi,bdo,cite,code,dfn,label,q, andrubyelements next to text (e.g.,a<code> b</code>)svgandmathelements, after a no-break space, around end tags that get dropped, and before removed comments next to text<!-- <script>…</script> -->, which browsers end only at a later</script>: The real end tag was dropped, which made the rest of the document script textremoveEmptyElementswithremoveOptionalTagsmishandling what surrounds removed elements:body(e.g., ascriptortitle)<a><p>b</p><footer></footer></a>lost</p>, and without abodystart tag before a removed element, a followingscriptmoved to thehead)removeEmptyElementsremoving an element that closes another one with no end tag, which moved what follows into that other element (e.g.,<p>a<div></div>bbecame<p>ab)removeEmptyElementsremoving emptyhtml,head, andbodyelements with attributes, which browsers don’t recreate (e.g.,<body class="a"></body>), andframesetelements, without which browsers render what followsremoveRedundantAttributes,removeDefaultTypeAttributes, andremoveEmptyAttributesremoving attributes that astyleelement in the document selects on (e.g.,typegiveninput[type=text])removeRedundantAttributesremovingnamefromaelements with a differentid, which broke links to the namecollapseWhitespaceremoving a trailing newline fromtextareaelements, which is part of their value--!>, and<!-->and<!--->not being read as empty comments—withremoveComments, content up to the next-->was deleted</tr>and</tbody>closing rows and sections that only have implied start tags were dropped, merging table rowstrand section start tags didn’t close an implied cell, whichremoveEmptyElementssaw as emptying the row<a><div></a>x</div>), and weren’t ignored from within a table when the element is outside it<span><div></span>x</div>)tableor, forli, a list (e.g.,<li><ul></li></ul>xlost</ul>)removeEmptyElementslosing 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>xlost</b>)PUBLIC "a b")removeOptionalTagscould leave one first and have it set the document mode (e.g.,<body></body><!doctype html>)removeOptionalTagsomitting thebodystart tag beforebase,basefont,bgsound,noframes, andtitleelements, which moved them to theheadminifyCSSemptying invalidmediaqueries, which made the style sheet apply (e.g.,media="only screen and 8px)")<a href="x""target="_blank">into a realtargetattribute—such a tag is now a parse error, and withcontinueOnParseErrorkeeps its"targetattributecontinueOnParseErrorturning tags with quotes in attribute names into text (e.g.,<img alt="a "b" c">, withdecodeEntities, became<img…)svgandmathelements being read as comments,svgelements inannotation-xmlbeing read as MathML, andisindexbeing read as a void elementAdded
npm testcompares parse5 trees and rendered whitespace across option combinations, generated markup, and html5lib’s parser tests, andnpm run test:equivalencedoes so for the real-world corpusChanged
--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 code1v5.0.2Compare Source
Fixed
minifyCSSandminifyJSdeleting or breaking custom fragments that start a rule or statement, follow acaseclause or label, or sit in an@charset,@import, or@namespacestatement 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>becameif(1===a) <?= $x ?>, which is wrong if the fragment renders several statements<script>l: <?= $x ?>;</script>lost the labelcollapseBooleanAttributesturninghidden="until-found"intohidden, which made the content unfindablecollapseBooleanAttributesremoving values that hold a custom fragment orhtmlmin:ignoremarkup, which deleted template code (e.g.,checked="<?= $c ?>"), andhiddenanddraggablevalues that hold a character reference, where only decoding shows the statecollapseBooleanAttributesremoving the loop count ofmarqueeelements (<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)collapseWhitespaceremoving spaces around and within SVGtspanandtextPathelements, which joined words (e.g.,a <tspan>b</tspan>becamea<tspan>b</tspan>)collapseWhitespacecollapsing whitespace within SVGscriptandstyleelements written in uppercase, which could break their code (e.g., a line comment in<svg><SCRIPT>swallowed the next line)collapseBooleanAttributesnot collapsingalpha,headingreset,nomodule,playsinline,shadowrootclonable,shadowrootcustomelementregistry,shadowrootdelegatesfocus, andshadowrootserializablecollapseBooleanAttributesremoving the values ofdefaultchecked,defaultmuted,defaultselected,enabled,indeterminate,pauseonexit, andvisible, none of which are HTML attributes (e.g.,<my-widget visible="false">became<my-widget visible>)Changed
collapseBooleanAttributesleave custom elements alone, as these define what their attributes mean (e.g.,<my-toggle checked="false">keeps its value)v5.0.1Compare Source
Fixed
minify()path, now replaced by linear-time scansv5.0.0Compare Source
Fixed
decodeEntities(andminifyJS, in event handler attributes) turning an escaped ampersand into one that starts a character reference, which changed the value browsers read (e.g.,title="&copy b"→title="© b", read as “© b,” now kept; and in text,&#​169→&#​169, now&#169)decodeEntities(andminifyJS, in event handler attributes) leaving character references without a semicolon in attributes undecoded where browsers decode them (e.g.,title="© b", nowtitle="© b")Changed
hmas a short CLI command next tohtml-minifierConfiguration
📅 Schedule: (UTC)
🚦 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.
This PR was generated by Mend Renovate. View the repository job log.