First of all, figure out what is the event in JS, and how the event model is designed in JS. What is event bubbling?What is "event bubbling"? Suppose there is a glass of water, and the water is divided into layers of different col
Event bubbling
Event Capture: parent-level elements are triggered first, and child-level elements are triggered later.
Event bubbling: Child-level elements are triggered first, and parent-level elements are triggered later.
Currently, in IE and FF, trigger events ar
Details about javascript event bubbling and javascript bubbling
Events are one of the core content in javascript. An important concept is inevitable in the application of events, that is, even
Time to learn the next JavaScript and jquery event design, the harvest is quite large, summed up this paste, and you share.
(i) Several ways of event binding
There are 2 ways in which JavaScript binds event handlers to the DOM: Binding in HTML documents and binding in JS c
First, let's introduce event bubbling and event capture.
The processing mechanism for events in the browser defaults to event bubbling, for example
#div1 {
width:500px;height:500px;
Background:rgb (12,42,31);
}
#div2 {
width:450px;height:450px;
Background:rgb (212,142
Stop event bubblingfunction Stopbubble (e) { //If an event object is provided, this is a non-ie browser if (e e.stoppropagation) { // So it supports the Stoppropagation () method e.stoppropagation (); } else { //Otherwise, we need to use IE to cancel event bubbling Window.event.c
proposed a completely opposite solution to ie, receiving events in the order of the root node to the specific node, which is the event capture. That is, in the above example, the order in which the click events are received is document,
DOM Event Stream
The event flow under "DOM2 level events" includes three phases: The e
event capture phase and the event bubbling phase. We can use the two methods provided by the "DOM2 level Event" AddEventListener () and RemoveEventListener () to bind or delete an event handler for a particular element:Element.addeventlistener (
capture, what will be the result, the code is as followsfunction () { alert (' I am the father! '); false ); document.getElementById (event) { alert (' I am a son! '); Event.stoppropagation (); false); This time again click "I am son ah" only pops up "I am the son", "I am the father" did not eject, this is what reason?Because the code above sets the event
Event flow refers to the order in which events are received in the page, IE, Firefox, and Chrome browsers are event bubbling, which is called event bubbling, where events are first received by the most specific elements and then propagated up to the nodes that are not specif
Compatible with the JavaScript blocking event bubbling code of various browsers, and javascript bubbling
Here is just a simple code demo, because the time issue has not been studied in depth, because the content that blocks event
Event bubbling: When an event on an element is triggered, such as a mouse click on a button, the same event will be triggered in all ancestors of that element, a process known as event bubbling.
This
Recently, I encountered some difficulties in learning javascript, such as bubbling and capturing. I have been mentioned many times, but I don't know where the application is. I have found some good articles to explain and share them with you here. Event bubbling and event ca
meaningless function calls. The 5 types of event bindings mentioned earlier can be used to prevent the propagation of events. Because of the 5th way, it is the most recommended practice. So we're looking at how to block the propagation of events based on the 5th way. IE8 and the continuation propagation of events that can be prevented by window.event.cancelbubble=true, Ie9+/ff/chrome prevents the continuation of events by Event.stoppropagation ().usi
1. Event Flow When the browser developed to the 4th generation, the browser development team encountered a problem: which element of the page would have a particular event? When you click a button, it is obvious that the click event does not just occur on the button, it also occurs on all ancestor elements of the button, such as the container element of the butto
Some of the most recent difficulties in learning JavaScript, such as bubbling and capturing, have been mentioned many times, but I don't know where to apply it. Found some good Article FAQ, here to share with you.
Event bubbling and event capture were presented by Microsoft
Note: The source of this article is translatable webEvent bubbling is a term you encounter while learning JavaScript, which involves invoking the order of event processing when one element is nested by another, and two elements registering the same event (for example, a click event
the red area, according to the above description, during bubble bubbling processing, the event is passed to Div2 after it is stopped, so the elements of the upper layer div2 not receive notification, so will appear:In a browser that supports DOM standards, add the following code:1 Document.body.addEventListener (' click ', Function (event) {2 event.stoppropagati
event bubbling is used.Ele.addeventlistener (' click ', dosomething2,true)True= captureFalse= BubbleTraditional bound Event modeIn a browser that supports the DOM, the usual way to bind events is to use event bubbling.Ele.onclick = DoSomething2IE browserAs mentioned above, IE only supports
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.