Which Jquery Events Do Not Bubble?
Solution 1:
The docs for jQuery's on() method says this (under "Additional Notes");
The
focusandblurevents are specified by the W3C to not bubble, but jQuery defines cross-browserfocusinandfocusoutevents that do bubble. Whenfocusandblurare used to attach delegated event handlers, jQuery maps the names and delivers them asfocusinandfocusoutrespectively. For consistency and clarity, use the bubbling event type names.In all browsers, the
load,scroll, anderrorevents (e.g., on an<img>element) do not bubble. In Internet Explorer 8 and lower, thepasteandresetevents do not bubble. Such events are not supported for use with delegation, but they can be used when the event handler is directly attached to the element generating the event.
I've bolded the most relevant sentences for emphasis.
Earlier in the docs (under "direct and delegated events", it also says this:
In Internet Explorer 8 and lower, a few events such as
changeandsubmitdo not natively bubble but jQuery patches these to bubble and create consistent cross-browser behavior.
You'll also find that mouseleave and mouseenter do not bubble (use the mouseover and mouseout events for that). This is discussed in their respective docs.
I wouldn't begin to call the above list comprehensive, but it's a start. I'm not sure how XMLHttpRequest comes into it in your question; it isn't part of the DOM, therefore doesn't have any ancestors, therefore cannot really bubble in the same way as normal DOM events.
Solution 2:
According to DOM Level 3 Events spec,
Events that bubble:
beforeinput,click,compositionstart,compositionupdate,compositionend,dblclick,focusin,focusout,input,keydown,keyup,mousedown,mousemove,mouseout,mouseover,mouseup,select,wheel.Events that don't bubble:
abort,blur,error,focus,load,mouseenter,mouseleave,resize,scroll,unload
Note DOM Level 3 Events doesn't define all events, some of them are defined by HTML5 spec.
That spec is less clear, because doesn't always say if events bubble and defines some events in non-normative sections. In one of these it says that drag-and-drop events bubble:
dragstart, drag, dragenter, dragexit, dragleave, dragover, drop, dragend.
Post a Comment for "Which Jquery Events Do Not Bubble?"