Skip to content

Remove passive event "polyfill" and unused randomElement() utility #1653

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

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

fturmel
Copy link
Collaborator

@fturmel fturmel commented Jul 11, 2024

We can remove this passive event listener polyfill thing - I don't think it ever was needed as it was introduced in 2022 (#82) but only exists because of old/dead Edge browser (pre Chromium I assume) from before 2017 and IE 11.
https://caniuse.com/passive-event-listener

I corrected the listeners usage too. The capture option is false by default, and the passive option is not required when removing the listener (it's not even a valid option to begin with).
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#passive
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#parameters

I also noticed the randomElement utility was never used and can be safely removed from the codebase.

Copy link

netlify bot commented Jul 11, 2024

Deploy Preview for codingtrain ready!

Name Link
🔨 Latest commit 0cc3f60
🔍 Latest deploy log https://app.netlify.com/sites/codingtrain/deploys/66900b211da1bf0008413cd8
😎 Deploy Preview https://deploy-preview-1653--codingtrain.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@shiffman
Copy link
Member

Hi @fturmel are there any pages I should load and test to confirm that these changes are working as intended! All looks great from my end but just want to double check before merging!

@fturmel
Copy link
Collaborator Author

fturmel commented Jul 12, 2024

You could look at the only feature connected to the passive event, which is persisting the scroll position of the content panel on the right side of the video component. See #82 and #46 for historical context.

This track for example: https://deploy-preview-1653--codingtrain.netlify.app/tracks/data-and-apis-in-javascript

CleanShot.2024-07-12.at.17.29.52.mp4

@shiffman
Copy link
Member

Great, thanks for this update and improvement!!

@shiffman shiffman merged commit ec687bd into CodingTrain:main Jul 12, 2024
5 checks passed
@fturmel fturmel deleted the PR/passive-events-cleanup branch July 12, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants