Document.timeline is a read-only instance property that returns the document’s default DocumentTimeline for the Web Animations API. Learn currentTime, Performance.timeOrigin, inactive null states, and five examples with try-it labs.
01
Kind
Read-only property
02
Returns
DocumentTimeline
03
Time base
timeOrigin
04
API
Web Animations
05
Inactive
currentTime null
06
Status
Baseline widely
Fundamentals
Introduction
CSS transitions and the Web Animations API need a shared clock so animations stay in sync. Every document has one default timeline that tracks elapsed time since the page’s performance time origin.
MDN: the timeline read-only property represents the default timeline of the current document. This timeline is a special instance of DocumentTimeline. It is unique to each document and persists for the lifetime of the document, including calls to Document.open().
💡
Milliseconds since time origin
MDN: the timeline expresses time in milliseconds since Performance.timeOrigin. Before the time origin it is inactive and currentTime is null.
Document.timeline is marked Baseline Widely available on MDN (since July 2020). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline · Widely available
Document.timeline
Read-only DocumentTimeline — default Web Animations clock with currentTime since timeOrigin.
WidelyAvailable
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerNot supported
No support
Document.timelineBaseline support
Bottom line: Use document.timeline to inspect the default animation clock. Pair with element.animate() and performance.now() for timing and debugging.
Wrap Up
Conclusion
Document.timeline is the default DocumentTimeline for Web Animations on a page. Read currentTime for milliseconds since Performance.timeOrigin, guard for null on inactive documents, and use it to understand how element.animate() stays synchronized.
Replace requestAnimationFrame with timeline reads for every frame
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about document.timeline
Default Web Animations clock for the document.
5
Core concepts
⏱01
Returns
DocumentTimeline
API
🕑02
Clock
currentTime
ms
🎯03
Origin
timeOrigin
MDN
🎬04
WAAPI
animate()
Sync
✅05
Status
Baseline
2020+
❓ Frequently Asked Questions
A read-only DocumentTimeline object representing the default timeline of the current document (MDN). It is used by the Web Animations API.
No. MDN marks Document.timeline as Baseline Widely available (since July 2020). It is part of the Web Animations specification.
MDN: milliseconds since Performance.timeOrigin. Before the time origin the timeline is inactive and currentTime is null.
Yes. MDN: the timeline is unique to each document and persists for the lifetime of the document, including calls to Document.open().
Animations on elements use document timelines by default. document.timeline is the root DocumentTimeline for the page.
MDN: before the time origin, or when the document is non-active (not associated with a Window, for example).
Did you know?
MDN states that the document timeline is unique to each document and persists for the entire lifetime of that document—even when you call document.open() to replace its contents. The same timeline object keeps ticking.