Skip to content

Commit ab299ac

Browse files
fix: avoid removing redundant attributes (#324)
1 parent 2e0b71e commit ab299ac

File tree

8 files changed

+802
-588
lines changed

8 files changed

+802
-588
lines changed

package-lock.json

Lines changed: 698 additions & 524 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,37 +46,37 @@
4646
"html-minifier-terser": "^5.1.1",
4747
"htmlparser2": "^4.1.0",
4848
"loader-utils": "^2.0.0",
49-
"schema-utils": "^2.7.0"
49+
"schema-utils": "^2.7.1"
5050
},
5151
"devDependencies": {
52-
"@babel/cli": "^7.10.5",
53-
"@babel/core": "^7.11.1",
54-
"@babel/preset-env": "^7.11.0",
55-
"@commitlint/cli": "^10.0.0",
56-
"@commitlint/config-conventional": "^10.0.0",
52+
"@babel/cli": "^7.11.6",
53+
"@babel/core": "^7.11.6",
54+
"@babel/preset-env": "^7.11.5",
55+
"@commitlint/cli": "^11.0.0",
56+
"@commitlint/config-conventional": "^11.0.0",
5757
"@webpack-contrib/defaults": "^6.3.0",
5858
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
5959
"babel-jest": "^26.3.0",
6060
"cross-env": "^7.0.2",
6161
"del": "^5.1.0",
6262
"del-cli": "^3.0.1",
6363
"es-check": "^5.1.0",
64-
"eslint": "^7.7.0",
64+
"eslint": "^7.9.0",
6565
"eslint-config-prettier": "^6.11.0",
6666
"eslint-plugin-import": "^2.22.0",
67-
"file-loader": "^6.0.0",
67+
"file-loader": "^6.1.0",
6868
"handlebars": "^4.7.6",
69-
"husky": "^4.2.5",
70-
"jest": "^26.4.0",
71-
"lint-staged": "^10.2.11",
69+
"husky": "^4.3.0",
70+
"jest": "^26.4.2",
71+
"lint-staged": "^10.4.0",
7272
"memfs": "^3.2.0",
7373
"npm-run-all": "^4.1.5",
74-
"posthtml": "^0.13.2",
75-
"posthtml-webp": "^1.5.0",
76-
"prettier": "^2.0.5",
74+
"posthtml": "^0.13.3",
75+
"posthtml-webp": "^2.1.0",
76+
"prettier": "^2.1.2",
7777
"standard-version": "^9.0.0",
7878
"url-loader": "^4.1.0",
79-
"webpack": "^4.44.1"
79+
"webpack": "^4.44.2"
8080
},
8181
"keywords": [
8282
"webpack",

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ const defaultMinimizerOptions = {
398398
// `minifyURLs` is unsafe, because we can't guarantee what the base URL is
399399
// `removeAttributeQuotes` is not safe in some rare cases, also HTML spec recommends against doing this
400400
removeComments: true,
401-
// `removeEmptyAttributes` is not safe, can affect certain style or script behavior
402-
removeRedundantAttributes: true,
401+
// `removeEmptyAttributes` is not safe, can affect certain style or script behavior, look at https://github.com/webpack-contrib/html-loader/issues/323
402+
// `removeRedundantAttributes` is not safe, can affect certain style or script behavior, look at https://github.com/webpack-contrib/html-loader/issues/323
403403
removeScriptTypeAttributes: true,
404404
removeStyleLinkTypeAttributes: true,
405405
// `useShortDoctype` is not safe for XHTML

test/__snapshots__/attributes-option.test.js.snap

Lines changed: 48 additions & 24 deletions
Large diffs are not rendered by default.

test/__snapshots__/esModule-option.test.js.snap

Lines changed: 12 additions & 6 deletions
Large diffs are not rendered by default.

test/__snapshots__/loader.test.js.snap

Lines changed: 4 additions & 2 deletions
Large diffs are not rendered by default.

test/__snapshots__/minimize-option.test.js.snap

Lines changed: 20 additions & 14 deletions
Large diffs are not rendered by default.

test/fixtures/simple.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,6 @@ <h2>An Ordered HTML List</h2>
355355
</svg>
356356
<svg>
357357
<script type="application/json" xlink:href="./script.file.js"></script>
358-
</svg>
358+
</svg>
359+
360+
<input type="text" name="test">

0 commit comments

Comments
 (0)