JavaScript learning notes (5) event processing: event stream and event processing function allocation

Source: Internet
Author: User
If you click a button on the page for example, you click the button first and then the action is passed in to the container of the button, after the Document is imported to the entire page, the Document is clicked first, and then the container of the button. What about the button click? If you click a button on the page for example, you click the button first and then the action is passed in to the container of the button, after the Document is imported to the entire page, the Document is clicked first, and then the container of the button. What about the button click?
JavaScript can handle this problem by calling it an event stream, that is, the event propagation mechanism. There are different interpretations of the event stream IE and FF. The solution in IE is called a bubble event, while FF is called a capture event. As the name implies, a bubble event is a low-level trigger mechanism, while a capture event is a top-down trigger mechanism. The book Javascript advanced programming mentions:
DOM Event streams support both event triggering mechanisms, but capture events occur first. Note that because the event Target (that is, the deepest node in the DOM tree) is the most precise element, in fact it will receive two consecutive events, one in the capture process, one is in the bubble process. Is it true? Observe the following program:


JAVASCRIPT event stream

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.