Bubble and capture Problems

Source: Internet
Author: User

1. The event stream describes the sequence of events received from the page.

2. the IE event stream is called event bubbling, that is, the event is received by the most specific element at the beginning of the event, and then spread to a more specific node step by step;

3. Another event stream proposed by the Netscape team is called event capture. The idea of event capturing is that not specific nodes receive events first, and then specific nodes should finally receive events.

4. dom2-level events stipulate that the event flow consists of three phases: Event capture stage, out-of-target stage, and event bubble stage. First, event capture provides an opportunity to intercept events, and then receives events from the actual target.

The last is the bubble stage, which can respond to events in this stage.

5. Cancel event bubbling: Cause-only want the event to occur on the target element rather than the parent element. Method: Add a method to cancel event bubbling;

6. Not all events can be bubble or captured, such as blur, focus, load, and unload.

// General functions that prevent event bubbles
Function stopbubble (e ){
// If an event object is input, it is a non-IE browser.
If (E & E. stoppropagation ){
// Therefore, it supports the W3C stoppropagation () method.
E. stoppropagation ();
} Else {
// Otherwise, we will use the IE Method to cancel event bubbling.
Window. event. cancelbubble = true;
}
}

Reference:

Http://www.cnblogs.com/zhenn/archive/2011/02/20/1959059.html

Http://www.cnblogs.com/zhenn/archive/2011/02/19/1958748.html

Http://www.liloy.info/archives/103.html

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.