Home >Web Front-end >JS Tutorial >How to implement JavaScript event bubbling and event capturing
This time I will bring you JavaSriptEventHow to implement bubbling and event capture, what are the notes for implementing JavaSript event bubbling and event capture, the following is a practical case, Let’s take a look.
Event flow describes the order in which events are received from the page. But at that time, when browsers developed to the fourth generation (IE4 and Netscape Communicator4), the IE and Netscape development teams each proposed the concept of event flow, and the concepts of the two sequential flows were almost opposite. As follows:
1. Event bubbling: This is the event flow of IE. Event bubbling means: when the event starts, the most specific element is received (the most specific refers to the deepest nested element in the document ), and then upload to unspecific nodes (documents) step by step.
2. Event capture: This is the event stream proposed by Netscape. As mentioned before, the two orders are almost opposite, so the event capture order is received by the least specific node (document), step by step passed to the deepest element. Let’s see an example:
##
# < title>Event Bubbling Example##
## Click Me