{"action":"created","issue":{"url":"https://api.github.com/repos/olahol/scrollparent.js/issues/4","repository_url":"https://api.github.com/repos/olahol/scrollparent.js","labels_url":"https://api.github.com/repos/olahol/scrollparent.js/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/olahol/scrollparent.js/issues/4/comments","events_url":"https://api.github.com/repos/olahol/scrollparent.js/issues/4/events","html_url":"https://github.com/olahol/scrollparent.js/pull/4","id":142021323,"number":4,"title":"Return scrollingElement || documentElement rather than body","user":{"login":"tremby","id":199635,"avatar_url":"https://avatars.githubusercontent.com/u/199635?v=3","gravatar_id":"","url":"https://api.github.com/users/tremby","html_url":"https://github.com/tremby","followers_url":"https://api.github.com/users/tremby/followers","following_url":"https://api.github.com/users/tremby/following{/other_user}","gists_url":"https://api.github.com/users/tremby/gists{/gist_id}","starred_url":"https://api.github.com/users/tremby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tremby/subscriptions","organizations_url":"https://api.github.com/users/tremby/orgs","repos_url":"https://api.github.com/users/tremby/repos","events_url":"https://api.github.com/users/tremby/events{/privacy}","received_events_url":"https://api.github.com/users/tremby/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-03-19T02:58:28Z","updated_at":"2017-01-01T18:41:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/olahol/scrollparent.js/pulls/4","html_url":"https://github.com/olahol/scrollparent.js/pull/4","diff_url":"https://github.com/olahol/scrollparent.js/pull/4.diff","patch_url":"https://github.com/olahol/scrollparent.js/pull/4.patch"},"body":"I feel like an idiot. In my last patch I switched this to `document.body`. But that's what `scrollTop` changes on in quirks mode. In standards mode it's supposed to change on the `html` element, `document.documentElement`. There are some inconsistencies between browsers, which is probably why I was confused, and to this day we as developers still have to test both. Chrome and Firefox do opposites.\n\n[This](https://miketaylr.com/posts/2014/11/document-body-scrolltop.html) explains some of it, and even recommends checking a third place, `document.body.parentNode` -- not sure which browsers that's for. But as for what scrollparent.js should return, I'd say probably the one in the standards. See also this [Chrome dev thread](https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/75hVThfrJ08/YD9kSgQljFEJ), one of the posts of which points out `document.scrollingElement`, which is supported in some but not all browsers.\n\nI think the best thing to return is the result of `document.scrollingElement || document.documentElement`, since that _should_ work in most cases.\n"},"comment":{"url":"https://api.github.com/repos/olahol/scrollparent.js/issues/comments/269914200","html_url":"https://github.com/olahol/scrollparent.js/pull/4#issuecomment-269914200","issue_url":"https://api.github.com/repos/olahol/scrollparent.js/issues/4","id":269914200,"user":{"login":"ethanresnick","id":471894,"avatar_url":"https://avatars.githubusercontent.com/u/471894?v=3","gravatar_id":"","url":"https://api.github.com/users/ethanresnick","html_url":"https://github.com/ethanresnick","followers_url":"https://api.github.com/users/ethanresnick/followers","following_url":"https://api.github.com/users/ethanresnick/following{/other_user}","gists_url":"https://api.github.com/users/ethanresnick/gists{/gist_id}","starred_url":"https://api.github.com/users/ethanresnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethanresnick/subscriptions","organizations_url":"https://api.github.com/users/ethanresnick/orgs","repos_url":"https://api.github.com/users/ethanresnick/repos","events_url":"https://api.github.com/users/ethanresnick/events{/privacy}","received_events_url":"https://api.github.com/users/ethanresnick/received_events","type":"User","site_admin":false},"created_at":"2017-01-01T18:41:13Z","updated_at":"2017-01-01T18:41:13Z","body":"+1 on this. I can confirm that mobile Safari, at least on iOS 10, now supports scrollTop. And Chrome <= 44 usage has already fallen in half since March. That means, between old Chrome and old Safari, we're talking ~2% of users for whom `document.scrollingElement || document.documentElement` won't work."}}
{"actor":{"display_login":"ethanresnick"}}