Events and event stream

First, what is the event with the event stream

  1. As we all know, HTML and JavaScript interaction is event-driven, we define the event to call a complete interactive page at a time. HTML page is a DOM tree, when a call to the elements

     When an event that will be between the node and the node is transmitted, and the event flow will describe the process of transmitting event. In short, the flow of events is described in order to receive events from the page.

    For example: a parent element has a child element, these two elements bind to a same event, triggered when clicked. When you click a child element actually triggered the parent element, the parent element is first outer trigger

    Child element of the event or the inner layer of the first trigger it? This is the event stream to be processed.

  2, the flow of events in two ways: event bubbling stream, event capture stream. (Now a mainstream event bubbling stream.)

   Event bubbling stream: the first element specific triggering event reception event, and then upward conduction

           

    Event Capture flow: on the contrary, the outermost layer of the first event is received and bubbling streams

 

  3, event flow has three phases: event capture phase ----> in the target stage ----> event bubbling stage

  

Guess you like

Origin www.cnblogs.com/qqinhappyhappy/p/11666922.html