From 16383a1749edc5a6d449884b0620b6b1082e0b64 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 20 Jul 2016 13:30:36 -0400 Subject: [PATCH] FIX: Also support just `open` --- app/assets/javascripts/pretty-text/sanitizer.js.es6 | 6 +++++- .../javascripts/lib/discourse-markdown/details.js.es6 | 2 +- .../test/javascripts/lib/details-cooked-test.js.es6 | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) 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(`
Infocoucou
`, `
Info\n\n

coucou

\n\n
`, "open attribute"); + + cooked(`
Infocoucou
`, + `
Info\n\n

coucou

\n\n
`, + "open attribute"); });