Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: load and error dispatch Event instead of UIEvent #1147

Merged
merged 1 commit into from Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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