Bubbling vs Capturing in JavaScript | JavaScript Events Tutorial

Veröffentlicht am: 30 April 2018
auf dem Kanal: dcode
37,130
1.1k

When working with events in JavaScript you have the option of using 'bubbling' or 'capturing' to define the order in which the event handlers fire off. In most cases, bubbling is default.

Typically you don't need to worry about capturing unless you need ultimate control over your event handlers. This concept is only relevant if you have a parent element and a child element which both have event listeners.

When using 'bubbling', events are fired off beginning with the child element and then go up to the parent.

In contrast, 'capturing' means that events are fired off from the parent first, and then down to the child element.

In this video I show you a simple example of how these two options differ with a 'paragraph' tag and a 'strong' tag.

For your reference, check this out:
https://developer.mozilla.org/en-US/d...

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!


Auf dieser Seite können Sie das Online-Video Bubbling vs Capturing in JavaScript | JavaScript Events Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer dcode 30 April 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 37,130 Mal angesehen und es wurde von 1.1 tausend den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!