Skip to content

Commit

Permalink
Allow crossOrigin on image tag (SVG) in no-unknown-properties
Browse files Browse the repository at this point in the history
Fixes #3250
  • Loading branch information
zpao committed Mar 21, 2022
1 parent 567bc7d commit 683497d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/rules/no-unknown-property.js
Expand Up @@ -27,7 +27,8 @@ const DOM_ATTRIBUTE_NAMES = {
};

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

const SVGDOM_ATTRIBUTE_NAMES = {
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/no-unknown-property.js
Expand Up @@ -53,6 +53,7 @@ ruleTester.run('no-unknown-property', rule, {
{ code: '<script crossOrigin />' },
{ code: '<audio crossOrigin />' },
{ code: '<div hasOwnProperty="should not be allowed tag" />' },
{ code: '<svg><image crossOrigin /></svg>' },
]),
invalid: parsers.all([
{
Expand Down Expand Up @@ -220,7 +221,7 @@ ruleTester.run('no-unknown-property', rule, {
data: {
name: 'crossOrigin',
tagName: 'div',
allowedTags: 'script, img, video, audio, link',
allowedTags: 'script, img, video, audio, link, image',
},
},
],
Expand Down

0 comments on commit 683497d

Please sign in to comment.