Skip to content

Commit

Permalink
[Fix] make onLoad and onError be accepted on more elements
Browse files Browse the repository at this point in the history
  • Loading branch information
sjarva committed Sep 4, 2022
1 parent f3a277d commit 3f29e77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 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 @@ -66,8 +66,8 @@ const ATTRIBUTE_TAGS_MAP = {
onEmptied: ['audio', 'video'],
onEncrypted: ['audio', 'video'],
onEnded: ['audio', 'video'],
onError: ['audio', 'video', 'img', 'script'],
onLoad: ['script', 'img'],
onError: ['audio', 'video', 'img', 'link', 'source', 'script'],
onLoad: ['script', 'img', 'link'],
onLoadedData: ['audio', 'video'],
onLoadedMetadata: ['audio', 'video'],
onLoadStart: ['audio', 'video'],
Expand Down
15 changes: 14 additions & 1 deletion tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,20 @@ ruleTester.run('no-unknown-property', rule, {
data: {
name: 'onError',
tagName: 'div',
allowedTags: 'audio, video, img, script',
allowedTags: 'audio, video, img, link, source, script',
},
},
],
},
{
code: '<div onLoad={this.load} />',
errors: [
{
messageId: 'invalidPropOnTag',
data: {
name: 'onLoad',
tagName: 'div',
allowedTags: 'script, img, link',
},
},
],
Expand Down

0 comments on commit 3f29e77

Please sign in to comment.