Document.scrollingElement is a read-only reference to the Element that scrolls the document (MDN). In standards mode this is usually the root element—document.documentElement (<html>).
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use document.scrollingElement. Start with this line.
JavaScript
document.scrollingElement
Call
What it does
document.scrollingElement
Primary signature.
Built into the browser. Read or assign document.scrollingElement — no import required.
Library declarations
JavaScript
document.scrollingElement
Parameters
Parameter
Description
scrollingElement
Required. Element that owns page scroll
scrollTop / scrollLeft
Optional. Position and programmatic scrolling
Return Value
Return Value
Description
*
The current value of document.scrollingElement.
JavaScript Examples
Example 1 — Read the Scrolling Element
Log which element scrolls the document in standards mode.
Same node in standards mode? true
compatMode: CSS1Compat
How It Works
Identity check.=== tests if both point to one object.
Standards pages. With <!DOCTYPE html>, both are usually <html>.
Mode context. Log compatMode to confirm standards-like rendering.
Why it matters. Prefer scrollingElement so quirks documents still resolve correctly when possible.
Compatibility
Browser Support
Document.scrollingElement is Baseline Widely available on MDN (since August 2016). It is the standard way to obtain the document’s scrolling root.
✓ Baseline · Widely available
Document.scrollingElement
Read-only Element that scrolls the document — usually documentElement in standards mode.
99%Browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
scrollingElementExcellent
Bottom line: Safe for modern apps. Always ship <!DOCTYPE html>, and null-check before calling scroll APIs if you must support quirks documents.
Frequently Asked Questions
A read-only reference to the Element that scrolls the document. MDN: in standards mode this is usually document.documentElement (the root <html> element).
No. MDN marks Document.scrollingElement as Baseline Widely available (since August 2016). It is the standard way to find the scrolling root.
MDN example: const scrollElm = document.scrollingElement; scrollElm.scrollTop = 0; You can also use window.scrollTo(0, 0).
In standards mode, yes — MDN says scrollingElement is the root element (documentElement). In quirks mode the behavior differs and may involve body or null.
MDN: in quirks mode scrollingElement returns the HTML body element if it exists and is not potentially scrollable; otherwise null.
Both work for page scroll. scrollingElement gives you the Element with scrollTop/scrollLeft. window.scrollTo is a convenient Window API for the same job.