MDN Web Docs

@mdn
2.6K Followers
5 Following
449 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

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

๐Ÿ“ฌ Check own properties safely with Object.hasOwn()

A safer alternative to hasOwnProperty, works even on objects with a null prototype.

Baseline since 2022 โœ…

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

Maintain perfect proportions with CSS aspect-ratio ๐Ÿ“

No more padding-top hacks for 16:9 videos or square avatars.

aspect-ratio: 16 / 9;

โ‹… Works with any box model
โ‹… Respects min/max dimensions
โ‹… Baseline since 2021 โœ…

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