Skip to content

Commit 683497d

Browse files
committed
Allow crossOrigin on image tag (SVG) in no-unknown-properties
Fixes #3250
1 parent 567bc7d commit 683497d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/rules/no-unknown-property.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const DOM_ATTRIBUTE_NAMES = {
2727
};
2828

2929
const ATTRIBUTE_TAGS_MAP = {
30-
crossOrigin: ['script', 'img', 'video', 'audio', 'link'],
30+
// image is required for SVG support, all other tags are HTML.
31+
crossOrigin: ['script', 'img', 'video', 'audio', 'link', 'image'],
3132
};
3233

3334
const SVGDOM_ATTRIBUTE_NAMES = {

tests/lib/rules/no-unknown-property.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ ruleTester.run('no-unknown-property', rule, {
5353
{ code: '<script crossOrigin />' },
5454
{ code: '<audio crossOrigin />' },
5555
{ code: '<div hasOwnProperty="should not be allowed tag" />' },
56+
{ code: '<svg><image crossOrigin /></svg>' },
5657
]),
5758
invalid: parsers.all([
5859
{
@@ -220,7 +221,7 @@ ruleTester.run('no-unknown-property', rule, {
220221
data: {
221222
name: 'crossOrigin',
222223
tagName: 'div',
223-
allowedTags: 'script, img, video, audio, link',
224+
allowedTags: 'script, img, video, audio, link, image',
224225
},
225226
},
226227
],

0 commit comments

Comments
 (0)