MDN Web Docs

@mdn
2.6K Followers
5 Following
451 Posts

The official MDN Web Docs account. We deliver the best web docs around.

Visit โ†’ https://mdn.dev
Contribute โ†’ https://mdn.dev/community

Homehttps://developer.mozilla.org
GitHubhttps://github.com/mdn
Bloghttps://mdn.dev/blog
Discordhttps://mdn.dev/discord

Hold object references without preventing garbage collection ๐Ÿ—‘๏ธ

`WeakRef` lets you reference an object while allowing it to be GCโ€™d if nothing else holds a strong reference. Use for caches, and pair with FinalizationRegistry.

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef

๐Ÿ†• Animate elements from display: none

CSS `@starting-style` lets you define the initial style for elements entering the page, enabling enter animations without JavaScript.

โ‹… Combine with transition
โ‹… Works with popover and dialog

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style

Measure your own code performance precisely โฑ๏ธ

`performance.mark()` and `performance.measure()` let you instrument JavaScript with high-precision timings.

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark

Creating a resolvable Promise just got cleaner ๐Ÿงน

`Promise.withResolvers()` returns { promise, resolve, reject }
No more wrapping logic inside the constructor.

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers

Run non-critical work without blocking the UI ๐Ÿ’ค

`requestIdleCallback()` schedules tasks during browser idle time.
โš ๏ธ Limited Availability

โ‹… Runs only when the main thread is free
โ‹… Great for analytics, prefetching, and cleanup

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback

Create frosted glass effects in CSS ๐ŸชŸ

backdrop-filter applies visual effects to the content behind an element โ€” blur, brightness, contrast, and more.

backdrop-filter: blur(10px) brightness(0.9);

No JavaScript. No canvas tricks.

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter

Wait for all promises, even the failing ones ๐Ÿ”„

`Promise.allSettled()` waits for every promise to finish, success or failure.

โ‹… Returns { status: 'fulfilled', value } or { status: 'rejected', reason }
โ‹… Perfect for batch operations

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled

Stop scroll chaining with overscroll-behavior ๐Ÿ›‘

Prevent modals and sidebars from accidentally scrolling the page behind them.
โ‹… Works on any scrollable element
โ‹… Also controls the bounce effect on mobile

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior

Access characters from the end of a string with .at() โœจ

str.at(-1) gets the last character, no more str[str.length - 1] gymnastics.

Works on strings, arrays, and typed arrays.

Learn more ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/at

๐Ÿ†• The URL Pattern API is Newly Available!

Use it to match and extract parts of URLs, no need to reinvent routing logic. Supports literals, wildcards, named groups, and even regex constraints.

Learn how it works ๐Ÿ‘‡
https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API