feat: Allow loading attribute on img (#278)
Signed-off-by: maosmurf <github@maosmurf.com>
This commit is contained in:
@@ -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: [],
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user