MDN Web Docs

@mdn
2.8K Followers
6 Following
549 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

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

✨ :only-child now matches elements with no parent!

The :only-child selector has been updated — it can now match elements that have no parent at all, not just sole children.

A subtle but useful spec alignment across all major browsers.

Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child

:only-child CSS pseudo-class - CSS | MDN

The :only-child CSS pseudo-class represents an element without any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity.

MDN Web Docs

✨ :only-child now matches elements with no parent!

The :only-child selector has been updated — it can now match elements that have no parent at all, not just sole children.

A subtle but useful spec alignment across all major browsers.

Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child

:only-child CSS pseudo-class - CSS | MDN

The :only-child CSS pseudo-class represents an element without any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity.

MDN Web Docs

Build smooth scroll experiences with CSS scroll snap 📜

Snap scrollable containers to specific positions — carousels, galleries, and paginated views with zero JavaScript.

Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_scroll_snap

CSS scroll snap - CSS | MDN

The CSS scroll snap module provides properties that let you control the panning and scrolling behavior by defining snap positions. Content can be snapped into position as the user scrolls overflowing content within a scroll container, providing paging and scroll positioning.

MDN Web Docs

📬 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

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

The CSS next-sibling combinator (+) selects an element only when it immediately follows another, same parent, no elements between them.

img + p { font-weight: bold; }

Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Next-sibling_combinator

🆕 Document.caretPositionFromPoint() is Newly Available!

Give it an (x, y) coordinate and get back the exact DOM node and character offset. Perfect for click-to-edit interfaces.

Check it out 👇
https://developer.mozilla.org/en-US/docs/Web/API/Document/caretPositionFromPoint

🆕 The Popover API is Baseline, no JavaScript needed

Tooltips, dropdowns, and menus with just HTML attributes.

⋅ popover attribute on any element
⋅ popovertarget to wire the trigger
⋅ Accessible by default, no ARIA hacks

Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/API/Popover_API

Better error chaining is finally in JavaScript 🔗

`Error.cause` lets you attach the original error when rethrowing, keeping full context without losing the stack.

Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause