FIX: Also support just `open`
This commit is contained in:
parent
e341596536
commit
16383a1749
|
@ -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 = {
|
||||
|
|
|
@ -25,7 +25,7 @@ export function setup(helper) {
|
|||
'summary',
|
||||
'summary[title]',
|
||||
'details',
|
||||
'details[open=open]',
|
||||
'details[open]',
|
||||
'details.elided'
|
||||
]);
|
||||
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue