feat: Allow loading attribute on img (#278)

Signed-off-by: maosmurf <github@maosmurf.com>
This commit is contained in:
Adam Zielinski
2023-03-23 03:19:18 +01:00
committed by GitHub
parent 4c3c7587f0
commit 8884b21308
2 changed files with 7 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ function getDefaultWhiteList() {
header: [],
hr: [],
i: [],
img: ["src", "alt", "title", "width", "height"],
img: ["src", "alt", "title", "width", "height", "loading"],
ins: ["datetime"],
li: [],
mark: [],

View File

@@ -133,6 +133,12 @@ describe("test XSS", function() {
),
'<img width="100" height="200" title="xxx" alt="\'yyy\'">'
);
assert.equal(
xss(
'<img loading="lazy">'
),
'<img loading="lazy">'
);
// 使用Tab或换行符分隔的属性
assert.equal(