Skip to content

Commit

Permalink
fix: load and error dispatch Event instead of UIEvent (#1147)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jul 9, 2022
1 parent 54bfa48 commit 29a17cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 10 additions & 5 deletions src/__tests__/events.js
Expand Up @@ -71,6 +71,16 @@ const eventTypes = [
events: ['scroll'],
elementType: 'div',
},
{
type: '',
events: ['load', 'error'],
elementType: 'img',
},
{
type: '',
events: ['load', 'error'],
elementType: 'script',
},
{
type: 'Wheel',
events: ['wheel'],
Expand Down Expand Up @@ -105,11 +115,6 @@ const eventTypes = [
],
elementType: 'video',
},
{
type: 'Image',
events: ['load', 'error'],
elementType: 'img',
},
{
type: 'Animation',
events: ['animationStart', 'animationEnd', 'animationIteration'],
Expand Down
8 changes: 6 additions & 2 deletions src/event-map.js
Expand Up @@ -274,9 +274,13 @@ export const eventMap = {
EventType: 'Event',
defaultInit: {bubbles: false, cancelable: false},
},
// Image Events
// Events
load: {
EventType: 'UIEvent',
// TODO: load events can be UIEvent or Event depending on what generated them
// This is were this abstraction breaks down.
// But the common targets are <img />, <script /> and window.
// Neither of these targets receive a UIEvent
EventType: 'Event',
defaultInit: {bubbles: false, cancelable: false},
},
error: {
Expand Down

0 comments on commit 29a17cb

Please sign in to comment.