Show Notes
In this Hasty Treat, Scott and Wes talk about javascript events, and how to avoid some common pitfalls!
Prismic - SponsorPrismic is a Headless CMS that makes it easy to build website pages as a set of components. Break pages into sections of components using React, Vue, or whatever you like. Make corresponding Slices in Prismic. Start building pages dynamically in minutes. Get started atΒ prismic.io/syntax.
Show Notes02:23 - Event bubbling
- Some events bubble, some donβt
- Clicks bubble
- Mouseevents bubble
- Focus doesnβt bubble
04:10 - Event capturing
- Capture: down, bubble up
- Canceling: prevent default
- target` vs currentTarget
- currentTarget is what got clicked
- target is what you listened for the click on
- event.isTrusted
- addEventListener once: true
- Scottβs Instagram
- LevelUpTutorials Instagram
- Wesβ Instagram
- Wesβ Twitter
- Wesβ Facebook
- Scottβs Twitter
- Make sure to includeΒ @SyntaxFMΒ in your tweets
