describe

Generally speaking, an event is an action performed by the user or the browser itself. It is a moment of interaction between a document or browser, such as a click button. Click is the name of the event. The interaction between JS and HTML is achieved through events, and DOM supports a large number of events. Note: Target and currentTarget are clicked by the user and listened by the developer

Flow of events

  • The event bubbling

Event bubbling is a stream of events in IE, which are received by the most specific element and propagated up the hierarchy, occurring at each node until propagated to the Document object, or bubbling to the Window object in browsers like Chrome (easy to remember, like a bubble in water).

  • Event capture

Event capture was the brainchild of the Netscape browser development team, which, interestingly, is the opposite of IE. That is, propagate from the least concrete node to the most concrete node, generally from the Document object.

  • Flow of events

The event flow defined here has three phases: the event capture phase, the target phase, and the event bubbling phase.

  • Characteristics of events

Bubbles indicates whether Bubbles occur, Cancelable indicates whether developers can cancel Bubbles, for example, Scroll does not

  • Cancel the bubbling
e.stopPropagation()
Copy the code
  • Forbidden scroll

Unwheel and TouchStart default actions for specific elements