Whitelist some more tags and add extra tests
This commit is contained in:
parent
2242568507
commit
fbfd3124a0
|
@ -99,63 +99,66 @@ export function whiteListFeature(feature, info) {
|
||||||
// Only add to `default` when you always want your whitelist to occur. In other words,
|
// Only add to `default` when you always want your whitelist to occur. In other words,
|
||||||
// don't change this for a plugin or a feature that can be disabled
|
// don't change this for a plugin or a feature that can be disabled
|
||||||
whiteListFeature('default', [
|
whiteListFeature('default', [
|
||||||
'br',
|
|
||||||
'p',
|
|
||||||
'strong',
|
|
||||||
'em',
|
|
||||||
'ins',
|
|
||||||
'del',
|
|
||||||
'abbr[title]',
|
|
||||||
'dl',
|
|
||||||
'dt',
|
|
||||||
'dd',
|
|
||||||
'blockquote',
|
|
||||||
'div',
|
|
||||||
'div.title',
|
|
||||||
'div.quote-controls',
|
|
||||||
'div[align]',
|
|
||||||
'i',
|
|
||||||
'b',
|
|
||||||
'ul',
|
|
||||||
'ol',
|
|
||||||
'li',
|
|
||||||
'small',
|
|
||||||
'code',
|
|
||||||
'span.mention',
|
|
||||||
'span.hashtag',
|
|
||||||
'span.excerpt',
|
|
||||||
'aside.quote',
|
|
||||||
'aside[data-*]',
|
|
||||||
'a[name]',
|
|
||||||
'a[target=_blank]',
|
|
||||||
'a[rel=nofollow]',
|
|
||||||
'a.attachment',
|
'a.attachment',
|
||||||
'a.onebox',
|
'a.hashtag',
|
||||||
'a.mention',
|
'a.mention',
|
||||||
'a.mention-group',
|
'a.mention-group',
|
||||||
'a.hashtag',
|
'a.onebox',
|
||||||
'a[name]',
|
|
||||||
'a[data-bbcode]',
|
'a[data-bbcode]',
|
||||||
|
'a[name]',
|
||||||
|
'a[name]',
|
||||||
|
'a[rel=nofollow]',
|
||||||
|
'a[target=_blank]',
|
||||||
'a[title]',
|
'a[title]',
|
||||||
'img[class]',
|
'abbr[title]',
|
||||||
'img[alt]',
|
'aside.quote',
|
||||||
'img[title]',
|
'aside[data-*]',
|
||||||
'img[width]',
|
'b',
|
||||||
'img[height]',
|
'blockquote',
|
||||||
'pre',
|
'br',
|
||||||
'hr',
|
'code',
|
||||||
|
'dd',
|
||||||
|
'del',
|
||||||
|
'div',
|
||||||
|
'div.quote-controls',
|
||||||
|
'div.title',
|
||||||
|
'div[align]',
|
||||||
|
'dl',
|
||||||
|
'dt',
|
||||||
|
'em',
|
||||||
'h1[id]',
|
'h1[id]',
|
||||||
'h2[id]',
|
'h2[id]',
|
||||||
'h3[id]',
|
'h3[id]',
|
||||||
'h4[id]',
|
'h4[id]',
|
||||||
'h5[id]',
|
'h5[id]',
|
||||||
'h6[id]',
|
'h6[id]',
|
||||||
|
'hr',
|
||||||
|
'i',
|
||||||
'iframe',
|
'iframe',
|
||||||
'iframe[height]',
|
|
||||||
'iframe[width]',
|
|
||||||
'iframe[frameborder]',
|
'iframe[frameborder]',
|
||||||
|
'iframe[height]',
|
||||||
'iframe[marginheight]',
|
'iframe[marginheight]',
|
||||||
'iframe[marginwidth]',
|
'iframe[marginwidth]',
|
||||||
|
'iframe[width]',
|
||||||
|
'img[alt]',
|
||||||
|
'img[class]',
|
||||||
|
'img[height]',
|
||||||
|
'img[title]',
|
||||||
|
'img[width]',
|
||||||
|
'ins',
|
||||||
'kbd',
|
'kbd',
|
||||||
'strike'
|
'li',
|
||||||
|
'ol',
|
||||||
|
'p',
|
||||||
|
'pre',
|
||||||
|
's',
|
||||||
|
'small',
|
||||||
|
'span.excerpt',
|
||||||
|
'span.hashtag',
|
||||||
|
'span.mention',
|
||||||
|
'strike',
|
||||||
|
'strong',
|
||||||
|
'sub',
|
||||||
|
'sup',
|
||||||
|
'ul',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -48,8 +48,14 @@ test("sanitize", function() {
|
||||||
|
|
||||||
cooked("<kbd>Ctrl</kbd>+<kbd>C</kbd>", "<p><kbd>Ctrl</kbd>+<kbd>C</kbd></p>");
|
cooked("<kbd>Ctrl</kbd>+<kbd>C</kbd>", "<p><kbd>Ctrl</kbd>+<kbd>C</kbd></p>");
|
||||||
cooked("it has been <strike>1 day</strike> 0 days since our last test failure", "<p>it has been <strike>1 day</strike> 0 days since our last test failure</p>");
|
cooked("it has been <strike>1 day</strike> 0 days since our last test failure", "<p>it has been <strike>1 day</strike> 0 days since our last test failure</p>");
|
||||||
|
cooked(`it has been <s>1 day</s> 0 days since our last test failure`, `<p>it has been <s>1 day</s> 0 days since our last test failure</p>`);
|
||||||
|
|
||||||
cooked(`<div align="center">hello</div>`, `<div align="center">hello</div>`);
|
cooked(`<div align="center">hello</div>`, `<div align="center">hello</div>`);
|
||||||
|
|
||||||
|
cooked(`1 + 1 is <del>3</del> <ins>2</ins>`, `<p>1 + 1 is <del>3</del> <ins>2</ins></p>`);
|
||||||
|
cooked(`<abbr title="JavaScript">JS</abbr>`, `<p><abbr title="JavaScript">JS</abbr></p>`);
|
||||||
|
cooked(`<dl><dt>Forum</dt><dd>Software</dd></dl>`, `<dl><dt>Forum</dt><dd>Software</dd></dl>`);
|
||||||
|
cooked(`<sup>high</sup> <sub>low</sub>`, `<p><sup>high</sup> <sub>low</sub></p>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("ids on headings", () => {
|
test("ids on headings", () => {
|
||||||
|
|
Loading…
Reference in New Issue