+ 3

bubbling and capturing

can anyone explains me what is bubbling and capturing?????

3rd Dec 2016, 6:40 AM
Rohan Yadav
Rohan Yadav - avatar
2 Answers
+ 6
Bubbling and capturing are types of event flow. When an event occurs on an HTML element with elements nested inside it, event flow determines the order element(s)' events are triggered. This is only a concern if nested elements causes multiple events to trigger at once. Ex: Clicking an <a> tag with an event, inside a <li> and <ol>, inside a <div> with an event, inside the <body>. Bubbling starts with the most deeply layered, specific element, and "bubbles up" to the outside ones. In the example above, events would trigger in order of a, then div. Capturing is in newer browsers, and works the opposite way of bubbling. It starts from the outermost tags, and control is "captured by" the element clicked on. The above example would work in order of div, then a.
3rd Dec 2016, 8:15 AM
Tamra
Tamra - avatar
0
thank you...
4th Dec 2016, 5:33 AM
Rohan Yadav
Rohan Yadav - avatar