Search code examples
javascriptperformanceeventsscrollevent-bubbling

Why does scroll event not bubble?


Today I've got kind of theoretical question. Why does scroll event not bubble? Is it connected with performance issues? I did some digging, but unfortunately didn't find any answers that would fulfill my curiosity.

Thanks for your replies :)


Solution

  • It bubbles but not on elements. It bubbles at the document object up to document.defaultView (window of the document). This behavior happens to avoid performance issues (scroll events can fire at a high rate).

    If you want to learn more about scrolling I would suggest reading the W3 documentation:

    https://www.w3.org/TR/cssom-view/#scrolling

    I hope it helps.