* @param {!Window} win * @return {!Element}
(win)
| 146 | * @return {!Element} |
| 147 | */ |
| 148 | function getScrollingElement(win) { |
| 149 | const doc = win.document; |
| 150 | if (doc./*OK*/ scrollingElement) { |
| 151 | return doc./*OK*/ scrollingElement; |
| 152 | } |
| 153 | if ( |
| 154 | doc.body && |
| 155 | // Due to https://bugs.webkit.org/show_bug.cgi?id=106133, WebKit |
| 156 | // browsers have to use `body` and NOT `documentElement` for |
| 157 | // scrolling purposes. This has mostly being resolved via |
| 158 | // `scrollingElement` property, but this branch is still necessary |
| 159 | // for backward compatibility purposes. |
| 160 | isWebKit(win.navigator.userAgent) |
| 161 | ) { |
| 162 | return doc.body; |
| 163 | } |
| 164 | return doc.documentElement; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Whether the current browser is based on the WebKit engine. |