Skip to content

Commit 3f29e77

Browse files
committed
[Fix] make onLoad and onError be accepted on more elements
1 parent f3a277d commit 3f29e77

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/rules/no-unknown-property.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ const ATTRIBUTE_TAGS_MAP = {
6666
onEmptied: ['audio', 'video'],
6767
onEncrypted: ['audio', 'video'],
6868
onEnded: ['audio', 'video'],
69-
onError: ['audio', 'video', 'img', 'script'],
70-
onLoad: ['script', 'img'],
69+
onError: ['audio', 'video', 'img', 'link', 'source', 'script'],
70+
onLoad: ['script', 'img', 'link'],
7171
onLoadedData: ['audio', 'video'],
7272
onLoadedMetadata: ['audio', 'video'],
7373
onLoadStart: ['audio', 'video'],

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

+14-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,20 @@ ruleTester.run('no-unknown-property', rule, {
389389
data: {
390390
name: 'onError',
391391
tagName: 'div',
392-
allowedTags: 'audio, video, img, script',
392+
allowedTags: 'audio, video, img, link, source, script',
393+
},
394+
},
395+
],
396+
},
397+
{
398+
code: '<div onLoad={this.load} />',
399+
errors: [
400+
{
401+
messageId: 'invalidPropOnTag',
402+
data: {
403+
name: 'onLoad',
404+
tagName: 'div',
405+
allowedTags: 'script, img, link',
393406
},
394407
},
395408
],

0 commit comments

Comments
 (0)