In Chrome, if I have an onscroll handler:
document.body.onscroll = function () {console.log('foo')}
... and I scroll through the document programmatically:
document.body.scrollTop = 7
... then the onscroll handler onscroll .
Can I depend on this behavior in browsers, or will someone only run the handler to scroll caused by user action? Is it indicated anywhere?
source share