mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 10:45:41 +08:00
FIX: Also support just open
This commit is contained in:
parent
e341596536
commit
16383a1749
@ -3,9 +3,13 @@ import xss from 'pretty-text/xss';
|
|||||||
const _validIframes = [];
|
const _validIframes = [];
|
||||||
|
|
||||||
function attr(name, value) {
|
function attr(name, value) {
|
||||||
|
if (value) {
|
||||||
return `${name}="${xss.escapeAttrValue(value)}"`;
|
return `${name}="${xss.escapeAttrValue(value)}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
const ESCAPE_REPLACEMENTS = {
|
const ESCAPE_REPLACEMENTS = {
|
||||||
"&": "&",
|
"&": "&",
|
||||||
"<": "<",
|
"<": "<",
|
||||||
|
@ -25,7 +25,7 @@ export function setup(helper) {
|
|||||||
'summary',
|
'summary',
|
||||||
'summary[title]',
|
'summary[title]',
|
||||||
'details',
|
'details',
|
||||||
'details[open=open]',
|
'details[open]',
|
||||||
'details.elided'
|
'details.elided'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -28,4 +28,8 @@ test("details", () => {
|
|||||||
cooked(`<details open="open"><summary>Info</summary>coucou</details>`,
|
cooked(`<details open="open"><summary>Info</summary>coucou</details>`,
|
||||||
`<details open="open"><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
|
`<details open="open"><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
|
||||||
"open attribute");
|
"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…
x
Reference in New Issue
Block a user