Skip to content

Commit

Permalink
[Fix] no-unknown-property: allow onLoad on <object>
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiiKachan authored and ljharb committed Sep 6, 2022
1 parent 73350de commit 1fa0888
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,12 +8,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
### Fixed
* [`no-unknown-property`]: add `viewBox` on `marker` ([#3416][] @ljharb)
* [`no-unknown-property`]: add `noModule` on `script` ([#3414][] @ljharb)
* [`no-unknown-property`]: allow `onLoad` on `<object>` ([#3415][] @OleksiiKachan)

### Changed

* [Meta] npmignore markdownlint config ([#3413][] @jorrit)

[#3416]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3416
[#3415]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3415
[#3414]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3414
[#3413]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3413

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unknown-property.js
Expand Up @@ -75,7 +75,7 @@ const ATTRIBUTE_TAGS_MAP = {
onEncrypted: ['audio', 'video'],
onEnded: ['audio', 'video'],
onError: ['audio', 'video', 'img', 'link', 'source', 'script', 'picture', 'iframe'],
onLoad: ['script', 'img', 'link', 'picture', 'iframe'],
onLoad: ['script', 'img', 'link', 'picture', 'iframe', 'object'],
onLoadedData: ['audio', 'video'],
onLoadedMetadata: ['audio', 'video'],
onLoadStart: ['audio', 'video'],
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/no-unknown-property.js
Expand Up @@ -66,6 +66,7 @@ ruleTester.run('no-unknown-property', rule, {
{ code: '<source onError={foo} />' },
{ code: '<link onLoad={bar} onError={foo} />' },
{ code: '<link rel="preload" as="image" href="someHref" imageSrcSet="someImageSrcSet" imageSizes="someImageSizes" />' },
{ code: '<object onLoad={bar} />' },
{ code: '<div allowFullScreen webkitAllowFullScreen mozAllowFullScreen />' },
{ code: '<table border="1" />' },
{
Expand Down Expand Up @@ -443,7 +444,7 @@ ruleTester.run('no-unknown-property', rule, {
data: {
name: 'onLoad',
tagName: 'div',
allowedTags: 'script, img, link, picture, iframe',
allowedTags: 'script, img, link, picture, iframe, object',
},
},
],
Expand Down

0 comments on commit 1fa0888

Please sign in to comment.