Skip to content

Commit eaddc87

Browse files
docs(html): say what normalizeUrlAttributes changes for a reader
`getAttribute` hands back the content attribute as written, so trimming one is a value a script comparing those bytes reads differently — which is the reason the switch exists. The description read as though the trim were the attribute's own doing, which is true of resolving the URL and of nothing else. Co-authored-by: aryanraj45 <[email protected]>
1 parent eb38865 commit eaddc87

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎declarations/WebpackOptions.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2606,7 +2606,7 @@ export interface OptimizationMinimizeHtml {
26062606
*/
26072607
normalizeNumericAttributes?: boolean;
26082608
/**
2609-
* Drop the ASCII whitespace around a URL value (`href`, `src`, `action`, `poster`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and `getAttribute` reads the trimmed string.
2609+
* Drop the ASCII whitespace around a URL value (`href`, `src`, `action`, `poster`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: `getAttribute` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.
26102610
* @since 5.111.0
26112611
*/
26122612
normalizeUrlAttributes?: boolean;

‎lib/html/syntax.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8920,7 +8920,7 @@ const mirrorSelectedContent = (node, select) => {
89208920
* @property {boolean=} normalizeEnumeratedAttributes fold an enumerated value to the keyword it names
89218921
* @property {boolean=} normalizeListAttributes normalize a space-, comma- or descriptor-separated list value (`class`, `rel`, `srcset`, `sizes`, the viewport `content`)
89228922
* @property {boolean=} normalizeNumericAttributes write an integer attribute the one way its rules read it
8923-
* @property {boolean=} normalizeUrlAttributes drop the whitespace around a URL value (`href`, `src`, `action`, …), which every URL parser strips
8923+
* @property {boolean=} normalizeUrlAttributes drop the whitespace around a URL value (`href`, `src`, `action`, …), which resolving the URL skips over
89248924
* @property {boolean=} removeOptionalTags leave out an optional tag other than the `<html>` / `<head>` / `<body>` shell, which is `removeImpliedTags`
89258925
*/
89268926

‎schemas/WebpackOptions.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3980,7 +3980,7 @@
39803980
"added": "5.110.0"
39813981
},
39823982
"normalizeUrlAttributes": {
3983-
"description": "Drop the ASCII whitespace around a URL value (`href`, `src`, `action`, `poster`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and `getAttribute` reads the trimmed string.",
3983+
"description": "Drop the ASCII whitespace around a URL value (`href`, `src`, `action`, `poster`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: `getAttribute` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.",
39843984
"type": "boolean",
39853985
"added": "5.111.0"
39863986
},

‎test/__snapshots__/Cli.basictest.js.snap‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11575,13 +11575,13 @@ Object {
1157511575
"optimization-minimize-html-normalize-url-attributes": Object {
1157611576
"configs": Array [
1157711577
Object {
11578-
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and \`getAttribute\` reads the trimmed string.",
11578+
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: \`getAttribute\` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.",
1157911579
"multiple": false,
1158011580
"path": "optimization.minimize.html.normalizeUrlAttributes",
1158111581
"type": "boolean",
1158211582
},
1158311583
],
11584-
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and \`getAttribute\` reads the trimmed string.",
11584+
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: \`getAttribute\` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.",
1158511585
"multiple": false,
1158611586
"simpleType": "boolean",
1158711587
},
@@ -12214,13 +12214,13 @@ Object {
1221412214
"optimization-minimize-options-html-normalize-url-attributes": Object {
1221512215
"configs": Array [
1221612216
Object {
12217-
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and \`getAttribute\` reads the trimmed string.",
12217+
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: \`getAttribute\` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.",
1221812218
"multiple": false,
1221912219
"path": "optimization.minimizeOptions.html.normalizeUrlAttributes",
1222012220
"type": "boolean",
1222112221
},
1222212222
],
12223-
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and \`getAttribute\` reads the trimmed string.",
12223+
"description": "Drop the ASCII whitespace around a URL value (\`href\`, \`src\`, \`action\`, \`poster\`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: \`getAttribute\` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.",
1222412224
"multiple": false,
1222512225
"simpleType": "boolean",
1222612226
},

‎types.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10852,7 +10852,7 @@ declare interface HtmlTransformOptions {
1085210852
normalizeNumericAttributes?: boolean;
1085310853

1085410854
/**
10855-
* drop the whitespace around a URL value (`href`, `src`, `action`, …), which every URL parser strips
10855+
* drop the whitespace around a URL value (`href`, `src`, `action`, …), which resolving the URL skips over
1085610856
*/
1085710857
normalizeUrlAttributes?: boolean;
1085810858

@@ -20413,7 +20413,7 @@ declare interface OptimizationMinimizeHtml {
2041320413
normalizeNumericAttributes?: boolean;
2041420414

2041520415
/**
20416-
* Drop the ASCII whitespace around a URL value (`href`, `src`, `action`, `poster`, …), which every URL parser strips before resolving it. On by default: the request goes to the same place either way, and `getAttribute` reads the trimmed string.
20416+
* Drop the ASCII whitespace around a URL value (`href`, `src`, `action`, `poster`, …), which resolving the URL skips over, so the request goes to the same place either way. On by default: `getAttribute` hands back the attribute as written, so a script comparing those bytes is the one this is turned off for.
2041720417
* @since 5.111.0
2041820418
*/
2041920419
normalizeUrlAttributes?: boolean;

0 commit comments

Comments
 (0)