diff --git a/app/assets/javascripts/pretty-text/sanitizer.js.es6 b/app/assets/javascripts/pretty-text/sanitizer.js.es6
index 9881eceef5e..a643169c399 100644
--- a/app/assets/javascripts/pretty-text/sanitizer.js.es6
+++ b/app/assets/javascripts/pretty-text/sanitizer.js.es6
@@ -3,7 +3,11 @@ import xss from 'pretty-text/xss';
const _validIframes = [];
function attr(name, value) {
- return `${name}="${xss.escapeAttrValue(value)}"`;
+ if (value) {
+ return `${name}="${xss.escapeAttrValue(value)}"`;
+ }
+
+ return name;
}
const ESCAPE_REPLACEMENTS = {
diff --git a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6 b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6
index 26e9efd5c7c..b710abf7e6f 100644
--- a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6
+++ b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6
@@ -25,7 +25,7 @@ export function setup(helper) {
'summary',
'summary[title]',
'details',
- 'details[open=open]',
+ 'details[open]',
'details.elided'
]);
diff --git a/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6 b/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
index 39d46882422..f020474e6cb 100644
--- a/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
+++ b/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
@@ -28,4 +28,8 @@ test("details", () => {
cooked(`Info
coucou `,
`Info
\n\ncoucou
\n\n `,
"open attribute");
+
+ cooked(`Info
coucou `,
+ `Info
\n\ncoucou
\n\n `,
+ "open attribute");
});