课程: Mastering Web Developer Interview Code

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

What are event bubbling and propagation about?

What are event bubbling and propagation about?

课程: Mastering Web Developer Interview Code

What are event bubbling and propagation about?

- [Instructor] Events are a huge part of what makes it possible to have dynamic pages. So knowing how to work with them and understanding how they work is pretty important. Now let's take a look at a real popular interview question that tests your understanding of events and that is about event propagation and how it works. The modern way to create events are by adding an event listener to an item in your DOM and you need to pass three different parameters. The first is the type of event that you want to track. So for example here would go a click or something else. The second is the callback or function that you want to execute when that event takes place and finally the type of propagation and the type of propagation is a boolean so you specify a true or a false value there. Now that determines the order in which the event is tracked through the DOM. We'll take a look at an example in just a minute but most of the time this…

内容