ui: fix check for void tags

This commit is contained in:
undefined committed 2022-02-11 18:42:21 +08:00
1 parent 562df8df6e
commit 66c5c6b560
2 files changed
+3 -2

No files matched your search

@@ -1,12 +1,13 @@
import * as Xss from 'xss';
const stack = [];
const voidTags = ['br', 'hr', 'input', 'img', 'link', 'source', 'col', 'area', 'base', 'meta', 'embed', 'param', 'track', 'wbr'];
const tagCheck = new Xss.FilterXSS({
css: false,
whiteList: {},
onIgnoreTag(tag, html, options) {
if (html.endsWith('/>')) return html;
if (html.endsWith('/>') || voidTags.includes(tag)) return html;
if (!options.isClosing) {
stack.push(tag);
return html;