FIX: Also support just `open`

This commit is contained in:
Robin Ward 2016-07-20 13:30:36 -04:00
parent e341596536
commit 16383a1749
3 changed files with 10 additions and 2 deletions

View File

@ -3,7 +3,11 @@ import xss from 'pretty-text/xss';
const _validIframes = [];
function attr(name, value) {
if (value) {
return `${name}="${xss.escapeAttrValue(value)}"`;
}
return name;
}
const ESCAPE_REPLACEMENTS = {

View File

@ -25,7 +25,7 @@ export function setup(helper) {
'summary',
'summary[title]',
'details',
'details[open=open]',
'details[open]',
'details.elided'
]);

View File

@ -28,4 +28,8 @@ test("details", () => {
cooked(`<details open="open"><summary>Info</summary>coucou</details>`,
`<details open="open"><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
"open attribute");
cooked(`<details open><summary>Info</summary>coucou</details>`,
`<details open><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
"open attribute");
});