Skip to content Skip to sidebar Skip to footer

Which Jquery Events Do Not Bubble?

Pretty straightforward, I've been searching high and low for a comprehensive list of all jQuery events that do not bubble but I have been unable to find one. For example I am looki

Solution 1:

The docs for jQuery's on() method says this (under "Additional Notes");

The focus and blur events are specified by the W3C to not bubble, but jQuery defines cross-browser focusin and focusout events that do bubble. When focus and blur are used to attach delegated event handlers, jQuery maps the names and delivers them as focusin and focusout respectively. For consistency and clarity, use the bubbling event type names.

In all browsers, the load, scroll, and error events (e.g., on an <img> element) do not bubble. In Internet Explorer 8 and lower, the paste and reset events 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 change and submit do 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?"