Skip to content

Commit

Permalink
Merge pull request #1659 from jzDev/jzDev/flip-crossorigin-rule
Browse files Browse the repository at this point in the history
Fixed crossorigin naming convention and missing tag support.
  • Loading branch information
ljharb authored Jan 27, 2018
2 parents 843d71a + 1d13218 commit d060041
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const DOM_ATTRIBUTE_NAMES = {
class: 'className',
for: 'htmlFor',
'http-equiv': 'httpEquiv',
crossOrigin: 'crossorigin'
crossorigin: 'crossOrigin'
};

const ATTRIBUTE_TAGS_MAP = {
crossorigin: ['script', 'img', 'video']
crossOrigin: ['script', 'img', 'video', 'link']
};

const SVGDOM_ATTRIBUTE_NAMES = {
Expand Down
14 changes: 7 additions & 7 deletions tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ruleTester.run('no-unknown-property', rule, {
code: '<div class="bar"></div>;',
options: [{ignore: ['class']}]
},
{code: '<script crossorigin />'}
{code: '<script crossOrigin />'}
],
invalid: [{
code: '<div class="bar"></div>;',
Expand Down Expand Up @@ -81,13 +81,13 @@ ruleTester.run('no-unknown-property', rule, {
output: '<rect clipPath="bar" />;',
errors: [{message: 'Unknown property \'clip-path\' found, use \'clipPath\' instead'}]
}, {
code: '<script crossOrigin />',
errors: [{message: 'Unknown property \'crossOrigin\' found, use \'crossorigin\' instead'}]
}, {
code: '<div crossOrigin />',
errors: [{message: 'Unknown property \'crossOrigin\' found, use \'crossorigin\' instead'}]
code: '<script crossorigin />',
errors: [{message: 'Unknown property \'crossorigin\' found, use \'crossOrigin\' instead'}]
}, {
code: '<div crossorigin />',
errors: [{message: 'Invalid property \'crossorigin\' found on tag \'div\', but it is only allowed on: script, img, video'}]
errors: [{message: 'Unknown property \'crossorigin\' found, use \'crossOrigin\' instead'}]
}, {
code: '<div crossOrigin />',
errors: [{message: 'Invalid property \'crossOrigin\' found on tag \'div\', but it is only allowed on: script, img, video, link'}]
}]
});

0 comments on commit d060041

Please sign in to comment.