mdn/dom-examples

Code examples that accompany various MDN DOM and Web API documentation pages

JavaScript

4,037

955 commits

updated Oct 5, 2026

See the code

README

dom-examples

Code examples that accompany various MDN DOM and Web API documentation pages.

[!NOTE] You can include an example directly in MDN pages using {{EmbedLiveSample()}} macros or regular Markdown code blocks. These methods are simpler to maintain as the code lives beside the rest of the content. Only add examples to this repository if your example doesn't easily run on MDN pages for technical or security reasons.

Browser support

When creating code examples for a technology that's not yet available in all major browsers, consider using feature detection to fall back to a simpler behavior or inform the user that their browser is not yet supported. Do not specify supported browsers and their versions in code comments or prose, as this information quickly becomes outdated.

Repository contents

Contribute to MDN Web Docs

You can contribute to MDN Web Docs and be a part of our community through content contributions, engineering, or translation work. The MDN Web Docs project welcomes contributions from everyone who shares our goals and wants to contribute constructively and respectfully within our community.

To find out how to get started, see the CONTRIBUTING.md document in this repository. By participating in and contributing to our projects and discussions, you acknowledge that you have read and agree to our Code of Conduct.

Get in touch

You can communicate with the MDN Web Docs team and community using the communication channels.

channel-messaging
demo
dom-manipulation
drag-drop
javascript
matchmedia
mdn
pointer-events
pointer-lock
touch-events

mdn/dom-examples

Code examples that accompany various MDN DOM and Web API documentation pages

JavaScript

4,037

955 commits

updated Oct 5, 2026

See the code

README

dom-examples

Code examples that accompany various MDN DOM and Web API documentation pages.

[!NOTE] You can include an example directly in MDN pages using {{EmbedLiveSample()}} macros or regular Markdown code blocks. These methods are simpler to maintain as the code lives beside the rest of the content. Only add examples to this repository if your example doesn't easily run on MDN pages for technical or security reasons.

Browser support

When creating code examples for a technology that's not yet available in all major browsers, consider using feature detection to fall back to a simpler behavior or inform the user that their browser is not yet supported. Do not specify supported browsers and their versions in code comments or prose, as this information quickly becomes outdated.

Repository contents

Contribute to MDN Web Docs

You can contribute to MDN Web Docs and be a part of our community through content contributions, engineering, or translation work. The MDN Web Docs project welcomes contributions from everyone who shares our goals and wants to contribute constructively and respectfully within our community.

To find out how to get started, see the CONTRIBUTING.md document in this repository. By participating in and contributing to our projects and discussions, you acknowledge that you have read and agree to our Code of Conduct.

Get in touch

You can communicate with the MDN Web Docs team and community using the communication channels.

channel-messaging
demo
dom-manipulation
drag-drop
javascript
matchmedia
mdn
pointer-events
pointer-lock
touch-events

Project health

Overall

6.8/10

Maintained

5/10

Code review

10/10
OpenSSF Scorecard

Significant stargazers

Konstantin Podsvirov

45 followers · starred Dec 2024

Michael Keller

419 followers · starred Apr 2023

Vasilii A

87 followers · starred Nov 2017

Kristóf Poduszló

319 followers · starred Mar 2026