Skip to main content

window.scrollTo()

Scrolls the viewport to a position. Specification: drafts.csswg.org/cssom-view/.

Results​

Probed on 2026-10-19 with Node.js v22.23.3.

warpdom 0.1.6​

Stub

0 of 2 checks work.

  • scrollTo(0, 0) and scrollTo({ top: 0, behavior: "instant" }) return without error. CSSOM View §4 (Extensions to the Window Interface): scrollTo() "must act as if the scroll() method was invoked with the same arguments", which takes (x, y) or a ScrollToOptions dictionary; "instant" is a ScrollBehavior value (§3.2).
    • Result: passed, but the engine reported "not implemented"
    • Logged by the engine: Not implemented: Window's scrollTo() method
  • With nothing to scroll (an empty document), scrollX and scrollY are 0 after scrollTo(0, 50). CSSOM View §4, scroll() method steps: "If the viewport has downward overflow direction, let y be max(0, min(y, viewport scrolling area height - viewport height))". The viewport scrolling area (§2) of an empty document is the initial containing block, as tall as the viewport, so y becomes 0, and the next steps end the call because the position equals the current one. scrollY "must return the y-coordinate … of the top of the viewport, or zero if there is no viewport", so 0 either way.
    • Result: passed, but the engine reported "not implemented"
    • Logged by the engine: Not implemented: Window's scrollTo() method
Report a wrong result for warpdom

happy-dom 21.0.3​

Partial

1 of 2 checks work.

  • With nothing to scroll (an empty document), scrollX and scrollY are 0 after scrollTo(0, 50). CSSOM View §4, scroll() method steps: "If the viewport has downward overflow direction, let y be max(0, min(y, viewport scrolling area height - viewport height))". The viewport scrolling area (§2) of an empty document is the initial containing block, as tall as the viewport, so y becomes 0, and the next steps end the call because the position equals the current one. scrollY "must return the y-coordinate … of the top of the viewport, or zero if there is no viewport", so 0 either way.
    • Result: scrollY: expected 0, got 50
Report a wrong result for happy-dom

jsdom 30.1.3​

Stub

0 of 2 checks work.

  • scrollTo(0, 0) and scrollTo({ top: 0, behavior: "instant" }) return without error. CSSOM View §4 (Extensions to the Window Interface): scrollTo() "must act as if the scroll() method was invoked with the same arguments", which takes (x, y) or a ScrollToOptions dictionary; "instant" is a ScrollBehavior value (§3.2).
    • Result: passed, but the engine reported "not implemented"
    • Logged by the engine: Not implemented: Window's scrollTo() method
  • With nothing to scroll (an empty document), scrollX and scrollY are 0 after scrollTo(0, 50). CSSOM View §4, scroll() method steps: "If the viewport has downward overflow direction, let y be max(0, min(y, viewport scrolling area height - viewport height))". The viewport scrolling area (§2) of an empty document is the initial containing block, as tall as the viewport, so y becomes 0, and the next steps end the call because the position equals the current one. scrollY "must return the y-coordinate … of the top of the viewport, or zero if there is no viewport", so 0 either way.
    • Result: passed, but the engine reported "not implemented"
    • Logged by the engine: Not implemented: Window's scrollTo() method
Report a wrong result for jsdom

linkedom 0.18.13​

Missing

Not defined in this engine's window.

Report a wrong result for linkedom

Checks​

  • callable: scrollTo(0, 0) and scrollTo({ top: 0, behavior: "instant" }) return without error. CSSOM View §4 (Extensions to the Window Interface): scrollTo() "must act as if the scroll() method was invoked with the same arguments", which takes (x, y) or a ScrollToOptions dictionary; "instant" is a ScrollBehavior value (§3.2). (spec)
  • scroll-position: With nothing to scroll (an empty document), scrollX and scrollY are 0 after scrollTo(0, 50). CSSOM View §4, scroll() method steps: "If the viewport has downward overflow direction, let y be max(0, min(y, viewport scrolling area height - viewport height))". The viewport scrolling area (§2) of an empty document is the initial containing block, as tall as the viewport, so y becomes 0, and the next steps end the call because the position equals the current one. scrollY "must return the y-coordinate … of the top of the viewport, or zero if there is no viewport", so 0 either way. (spec)

Working around it in tests​

Tests commonly assign a no-op or a mock: window.scrollTo = () => {} (or vi.fn() / jest.fn()).