You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1acff82
Browse filesBrowse the repository at this point in the historyBrowse files
fix(html): read a <script type> decoded, and trim an inline script
An attribute value is stored raw, so `type="text/javascript"` was read
as a data block while the parser and every browser read it as JavaScript:
its body never reached the JS renderer, and an entity-spelled
`application/ld+json` was left unminified beside an attribute the
printer had already decoded. `removeRedundantAttributes` read the same
value raw, so the two disagreed about one `<script>`.
An inline script whose type names JavaScript now also loses the whitespace
at its edges, which sits between tokens rather than in the program. A body
that is only whitespace keeps it: emptying the element would hand it to
`removeEmptyElements`. A data block's body is left alone — its whitespace
can be its own syntax, as an indented YAML or Markdown payload shows.
Co-authored-by: aryanraj45 <[email protected]>
* Collapse each run of whitespace in text to a single space. Left alone inside `pre`, `textarea` and `listing`, where whitespace renders verbatim. `true` (or `"conservative"`) never removes whitespace entirely — dropping it would join two inline elements that render apart. `"smart"` also drops the whitespace that sits against a block element's edge, where no line box reaches it. `"all"` drops the whitespace at every text node's edges, which does change how adjacent inline elements render.
2503
+
* Collapse each run of whitespace in text to a single space. Left alone inside `pre`, `textarea` and `listing`, where whitespace renders verbatim. `true` (or `"conservative"`) never removes whitespace entirely — dropping it would join two inline elements that render apart. `"smart"` also drops the whitespace that sits against a block element's edge, where no line box reaches it. `"all"` drops the whitespace at every text node's edges, which does change how adjacent inline elements render. An inline `<script>` holding JavaScript or JSON is trimmed at its edges in every tier, that whitespace sitting outside the program text; a data block's body is left alone, its own whitespace being part of its syntax.
* @property {boolean=} rewriteCustomProperties CSS's too, handed over with `environment` (see `HtmlPrintOptions`)
8935
8935
* @property {CssTransformOptions=} cssTransforms CSS's per-transform switches too, handed over with `environment` (see `HtmlPrintOptions`)
8936
8936
* @property {HtmlTransformOptions=} transforms which of the meaning-preserving rewrites the minifying print makes; each is on unless it is `false`
8937
-
* @property {(boolean | "conservative" | "smart" | "all")=} collapseWhitespace collapse each run of whitespace in text to a single space, except where an ancestor renders it verbatim; `"smart"` also drops what sits against a block edge and `"all"` drops every edge (default false)
8937
+
* @property {(boolean | "conservative" | "smart" | "all")=} collapseWhitespace collapse each run of whitespace in text to a single space, except where an ancestor renders it verbatim; `"smart"` also drops what sits against a block edge and `"all"` drops every edge; an inline `<script>` holding JavaScript or JSON is trimmed at its edges, a data block's body never (default false)
8938
8938
* @property {boolean=} removeEmptyAttributes drop an attribute whose empty value leaves it in the state its absence gives (default false)
8939
8939
* @property {boolean=} removeEmptyElements drop an element with no children and no attributes, unless its bare form is meaningful (default false)
8940
8940
* @property {boolean=} mergeStyles print a run of adjacent `<style>` elements as one sheet, which removes elements (default false)
Copy file name to clipboardExpand all lines: schemas/WebpackOptions.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3833,7 +3833,7 @@
3833
3833
"added": "5.110.0"
3834
3834
},
3835
3835
"collapseWhitespace": {
3836
-
"description": "Collapse each run of whitespace in text to a single space. Left alone inside `pre`, `textarea` and `listing`, where whitespace renders verbatim. `true` (or `\"conservative\"`) never removes whitespace entirely — dropping it would join two inline elements that render apart. `\"smart\"` also drops the whitespace that sits against a block element's edge, where no line box reaches it. `\"all\"` drops the whitespace at every text node's edges, which does change how adjacent inline elements render.",
3836
+
"description": "Collapse each run of whitespace in text to a single space. Left alone inside `pre`, `textarea` and `listing`, where whitespace renders verbatim. `true` (or `\"conservative\"`) never removes whitespace entirely — dropping it would join two inline elements that render apart. `\"smart\"` also drops the whitespace that sits against a block element's edge, where no line box reaches it. `\"all\"` drops the whitespace at every text node's edges, which does change how adjacent inline elements render. An inline `<script>` holding JavaScript or JSON is trimmed at its edges in every tier, that whitespace sitting outside the program text; a data block's body is left alone, its own whitespace being part of its syntax.",
0 commit comments