diff --git a/src/language-html/clean.js b/src/language-html/clean.js
index 9eddce405..a6fd8a974 100644
--- a/src/language-html/clean.js
+++ b/src/language-html/clean.js
@@ -39,7 +39,38 @@ function clean(original, cloned) {
}
if (original.type === "attribute") {
- delete cloned.value;
+ const { fullName: name, value } = original;
+
+ if (
+ // HTML attributes
+ name === "style" ||
+ name === "class" ||
+ name === "srcset" ||
+ name.startsWith("on") ||
+ // Vue attributes
+ name.startsWith("@") ||
+ name.startsWith(":") ||
+ name.startsWith(".") ||
+ name.startsWith("#") ||
+ name.startsWith("v-") ||
+ name === "vars" ||
+ name === "setup" ||
+ name === "generic" ||
+ name === "slot-scope" ||
+ // Angular attributes
+ name.startsWith("(") ||
+ name.startsWith("[") ||
+ name.startsWith("*") ||
+ name.startsWith("bind") ||
+ name.startsWith("i18n") ||
+ name.startsWith("on-") ||
+ name.startsWith("ng-") ||
+ value?.includes("{{")
+ ) {
+ delete cloned.value;
+ } else if (value) {
+ cloned.value = value.replaceAll(/'|"|'/gu, '"');
+ }
}
if (original.type === "docType") {