Skip to content

Conversation

@vipulnsward
Copy link
Member

Motivation / Background

Usage of Event.initevent has been deprecated - https://developer.mozilla.org/en-US/docs/web/api/event/initevent

Replace and make use of Event constructor instead- https://developer.mozilla.org/en-US/docs/Web/API/Event/Event

Detail

  • Replace usage of Event.initevent and document.createEvent("Event") with simplified Event constructor instead
  • Pass down same options to constructor as before
  • Also runs yarn build to update current builds of AS.js and esm modules

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.
Copy link
Member

@skipkayhil skipkayhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Makes sense to me

const { disabled } = element
const { bubbles, cancelable, detail } = eventInit
const event = document.createEvent("Event")
const event = new Event(type, {bubbles: bubbles || true, cancelable: cancelable || true})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to the change at hand: would it be possible to pass anything other than true for bubbles and cancelable? Seems like falsey values would always get overriden

Copy link
Member Author

@vipulnsward vipulnsward Mar 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aah, that is true. I just din't want to change from existing values and keep the code same as before 😅
For backwards compat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants