diff --git a/crates/swc_html_codegen/src/lib.rs b/crates/swc_html_codegen/src/lib.rs
index 49cd14d8a7d..f1e7a50bba1 100644
--- a/crates/swc_html_codegen/src/lib.rs
+++ b/crates/swc_html_codegen/src/lib.rs
@@ -857,9 +857,9 @@ fn minify_attribute_value(value: &str) -> String {
}
if dq > sq {
- format!("'{}'", minified)
+ format!("'{}'", minified.replace('\'', "'"))
} else {
- format!("\"{}\"", minified)
+ format!("\"{}\"", minified.replace('"', """))
}
}
diff --git a/crates/swc_html_codegen/tests/fixture/attribute/input.html b/crates/swc_html_codegen/tests/fixture/attribute/input.html
index dc8909cae06..f571409a581 100644
--- a/crates/swc_html_codegen/tests/fixture/attribute/input.html
+++ b/crates/swc_html_codegen/tests/fixture/attribute/input.html
@@ -150,5 +150,32 @@ __ bind(¤t);
ø &osLash; Ø
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+