• Stars
    star
    4,803
  • Rank 8,381 (Top 0.2 %)
  • Language JSON
  • License
    Creative Commons ...
  • Created about 8 years ago
  • Updated 6 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This repository contains compatibility data for Web technologies as displayed on MDN

@mdn/browser-compat-data

https://github.com/mdn/browser-compat-data

The browser-compat-data ("BCD") project contains machine-readable browser (and JavaScript runtime) compatibility data for Web technologies, such as Web APIs, JavaScript features, CSS properties and more. Our goal is to document accurate compatibility data for Web technologies, so web developers may write cross-browser compatible websites easier. BCD is used in web apps and software such as MDN Web Docs, CanIUse, Visual Studio Code, WebStorm and more.

Read how this project is governed.

Chat with us on Matrix at chat.mozilla.org#mdn!

Installation and Import

NodeJS

You can install @mdn/browser-compat-data as a node package.

npm install @mdn/browser-compat-data
# ...or...
yarn add @mdn/browser-compat-data

Then, you can import BCD into your project with either import or require():

// ESM with Import Assertions (NodeJS 16+)
import bcd from '@mdn/browser-compat-data' assert { type: 'json' };
// ...or...
const { default: bcd } = await import('@mdn/browser-compat-data', {
  assert: { type: 'json' },
});

// ...or...

// ESM Wrapper for older NodeJS versions (NodeJS v12+)
import bcd from '@mdn/browser-compat-data/forLegacyNode';
// ...or...
const { default: bcd } = await import('@mdn/browser-compat-data/forLegacyNode');

// ...or...

// CommonJS Module (Any NodeJS)
const bcd = require('@mdn/browser-compat-data');

Deno/Browsers

You can import @mdn/browser-compat-data using a CDN.

import bcd from 'https://unpkg.com/@mdn/browser-compat-data' assert { type: 'json' };
// ...or...
const { default: bcd } = await import(
  'https://unpkg.com/@mdn/browser-compat-data',
  {
    assert: { type: 'json' },
  }
);

Other Languages

You can obtain the raw compatibility data for @mdn/browser-compat-data using a CDN and loading the data.json file included in releases.

https://unpkg.com/@mdn/browser-compat-data/data.json

Usage

Once you have imported BCD, you can access the compatibility data for any feature by accessing the properties of the dictionary.

// Grab the desired support statement
const support = bcd.css.properties.background.__compat;
// returns a compat data object (see schema)

// You may use any syntax to obtain dictionary items
const support = bcd['api']['Document']['body']['__compat'];

Package contents

The @mdn/browser-compat-data package contains a tree of objects, with support and browser data objects at their leaves. There are over 12,000 features in the dataset; this documentation highlights significant portions, but many others exist at various levels of the tree.

The definitive description of the format used to represent individual features and browsers is the schema definitions.

Apart from the explicitly documented objects below, feature-level support data may change at any time. See Semantic versioning policy for details.

The package contains the following top-level objects:

__meta

An object containing the following package metadata:

  • version - the package version
  • timestamp - the timestamp of when the package version was built

api

Data for Web API features.

browsers

Data for browsers and JavaScript runtimes. See the browser schema for details.

css

Data for CSS features, including:

  • at-rules - at-rules (e.g. @media)
  • properties - Properties (e.g. background, color, font-variant)
  • selectors - Selectors (such as basic selectors, combinators, or pseudo elements)
  • types - Value types for rule values

html

Data for HTML features, including:

  • elements - Elements
  • global_attributes - Global attributes
  • manifest - Web App manifest keys

http

Data for HTTP features, including:

  • headers - Request and response headers
  • methods - Request methods
  • status - Status codes

javascript

Data for JavaScript language features, including:

  • builtins - Built-in objects
  • classes - Class definition features
  • functions - Function features
  • grammar - Language grammar
  • operators - Mathematical and logical operators
  • statements - Language statements and expressions

mathml

Data for MathML features, including:

  • elements - Elements

svg

Data for SVG features, including:

  • attributes - Attributes
  • elements - Elements

webassembly

Data for WebAssembly features.

webdriver

Data for WebDriver features.

webextensions

Data for WebExtensions features, including:

  • api - WebExtension-specific APIs
  • manifest - manifest.json keys

Semantic versioning policy

For the purposes of semantic versioning (SemVer), the public API consists of:

  • The high-level namespace objects documented in Package contents
  • The schema definitions for browser and support data structures
  • The TypeScript definitions

The details of browser compatibility change frequently, as browsers ship new features, standards organizations revise specifications, and Web developers discover new bugs. We routinely publish updates to the package to reflect these changes.

You should expect lower-level namespaces, feature data, and browser data to be added, removed, or modified at any time. That said, we strive to communicate changes and preserve backward compatibility; if you rely on a currently undocumented portion of the package and want SemVer to apply to it, please open an issue.

Issues?

If you find a problem with the compatibility data (such as incorrect version numbers) or there is a new web feature you think we should document, please file a bug.

Contributing

Thank you for your interest in contributing to this project! See Contributing to browser-compat-data for more information.

Projects using the data

Here are some projects using the data, as an npm module or directly:

  • Add-ons Linter - the Add-ons Linter is used on addons.mozilla.org and the web-ext tool. It uses browser-compat-data to check that the Firefox version that the add-on lists support for does in fact support the APIs used by the add-on.
  • caniuse - In addition to the existing caniuse database, caniuse includes features from the MDN BCD project, formatted and interactive like any other caniuse support table.
  • CanIUse Embed - Thanks to the inclusion of MDN BCD data in caniuse, this embed tool allows for embedding BCD data into any project.
  • Compat Report - Firefox Add-on that shows compatibility data for the current site in the developer tools.
  • compat-tester - Scan local documents for compatibility issues.
  • Visual Studio Code - Shows the compatibility information in the code completion popup.
  • webhint.io - Hints to check if your CSS HTML and JavaScript have deprecated or not broadly supported features.
  • WebStorm - JavaScript IDE allowing you to check whether all CSS properties you use are supported in the target browser version.
  • Hexo Plugin: hexo-compat-report - Allows to embed MDN's compatibility table in a hexo blog post.

Acknowledgments

Thanks to:

BrowserStack

The BrowserStack Open Source Program for testing services

Testing Powered By Sauce Labs

Sauce Labs Open Source for testing services

LambdaTest

LambdaTest Open Source for testing services

More Repositories

1

content

The content behind MDN Web Docs
Markdown
8,869
star
2

learning-area

GitHub repo for the MDN Learning Area.
HTML
6,739
star
3

webextensions-examples

Example Firefox add-ons created using the WebExtensions API
JavaScript
3,972
star
4

dom-examples

Code examples that accompany various MDN DOM and Web API documentation pages
JavaScript
3,198
star
5

web-components-examples

A series of web components examples, related to the MDN web components documentation at https://developer.mozilla.org/en-US/docs/Web/Web_Components.
JavaScript
2,975
star
6

serviceworker-cookbook

It's online. It's offline. It's a Service Worker!
JavaScript
2,767
star
7

kuma

The project that powers MDN.
Python
1,932
star
8

translated-content

The source repository of all translated content for MDN Web Docs
Markdown
1,610
star
9

django-locallibrary-tutorial

Local Library website written in Django; example for the MDN server-side development Django module: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django.
Python
1,535
star
10

web-speech-api

A repository for demos illustrating features of the Web Speech API. See https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API for more details.
JavaScript
1,413
star
11

mdn

Holding repo for MDN Web Docs things
1,263
star
12

webaudio-examples

Code examples that accompany the MDN Web Docs pages relating to Web Audio.
HTML
1,197
star
13

webgl-examples

Code examples that accompany the MDN WebGL documentation
JavaScript
1,196
star
14

express-locallibrary-tutorial

Local Library website written in NodeJS/Express; example for the MDN server-side development NodeJS module: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs.
JavaScript
1,190
star
15

yari

The platform code behind MDN Web Docs
TypeScript
1,145
star
16

js-examples

Code examples that accompany the MDN JavaScript/ECMAScript documentation
JavaScript
1,090
star
17

webassembly-examples

Code examples that accompany the MDN WebAssembly documentation โ€” see https://developer.mozilla.org/en-US/docs/WebAssembly.
WebAssembly
1,087
star
18

samples-server

MDN samples server; used for samples that can't be hosted in-place on MDN, plus back-end server-side code for samples that need it.
JavaScript
953
star
19

pwa-examples

Examples for progressive web apps.
JavaScript
902
star
20

sw-test

Service Worker test repository. This is a very simple demo to show basic service worker features in action.
JavaScript
756
star
21

simple-web-worker

A simple web worker test.
JavaScript
722
star
22

data

This repository contains general data for Web technologies
JavaScript
714
star
23

interactive-examples

Home of the MDN live code editor interactive examples
HTML
708
star
24

voice-change-o-matic

Web Audio API-powered voice changer and visualizer
JavaScript
705
star
25

css-examples

Code examples that accompany the MDN CSS documentation
HTML
582
star
26

fetch-examples

A repository of Fetch examples. See https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API for the corresponding documentation.
HTML
513
star
27

web-dictaphone

A sample MDN app that uses getUserMedia and MediaRecorder API for recording audio snippets, and The Web Audio API for visualizations.
JavaScript
480
star
28

to-do-notifications

Enhanced version of the to-do app, which stores to-do items via IndexedDB, and then also aims to provide notifications when to-do item deadlines are up, via the Notification and Vibration APIs.
JavaScript
383
star
29

curriculum

MDN front-end developer curriculum
Shell
351
star
30

beginner-html-site

A simple one page website created to help complete beginners learn HTML basics.
HTML
284
star
31

beginner-html-site-scripted

A simple one page website created to help complete beginners learn HTML basics. which in this repo has also had some script added to help beginners learn JavaScript basics.
HTML
255
star
32

violent-theremin

Violent theremin uses the Web Audio API to generate sound, and HTML5 canvas for a bit of pretty visualization. The colours generated depend on the pitch and gain of the current note, which are themselves dependant on the mouse pointer position.
JavaScript
239
star
33

todo-react

Sample todo app built with the React/ReactDOM framework.
JavaScript
215
star
34

django-diy-blog

Basic blog site written in Django (part of MDN Django module assessment).
Python
204
star
35

beginner-html-site-styled

A simple one page website created to help complete beginners learn HTML basics, which in this repo has also been styled to help beginners learn CSS basics. The styling is explained over the course of https://developer.mozilla.org/en-US/Learn/Getting_started_with_the_web/CSS_basics.
HTML
204
star
36

simple-shared-worker

A simple demo to show shared worker basics.
HTML
198
star
37

sprints

Archived: MDN Web Docs issues are tracked in the content repository.
150
star
38

canvas-raycaster

Using the <canvas> element to do software rendering of a 3D environment with ray-casting
JavaScript
148
star
39

kumascript

Bringing scripting to the wiki bears.
HTML
130
star
40

mdn-community

A place to provide feedback and suggestions for MDN Web Docs
119
star
41

mdn-minimalist

The base Sass for Mozilla Developer based projects and products
SCSS
110
star
42

todo-vue

Sample todo app built with the Vue framework
Vue
99
star
43

html-examples

Code examples that accompany the MDN HTML documentation: https://developer.mozilla.org/en-US/docs/Web/HTML
HTML
89
star
44

advanced-js-fundamentals-ck

This content kit provides learning material to allow intermediate web developers to level up their skills, learning real world techniques to take them past rudimentary syntax towards a solid foundation of skills than can be utilized to create modern web applications. It'll be visual; you'll have fun along the way.
JavaScript
81
star
45

webvr-tests

A set of simple tests for testing WebVR functionality. See https://developer.mozilla.org/en-US/docs/Web/API/WebVR_API for the latest on the documentation.
JavaScript
76
star
46

bob

Builder of Bits aka The MDN Web Docs interactive examples, example builder
TypeScript
74
star
47

headless-examples

Examples to support the MDN resource covering Firefox headless mode โ€” see https://developer.mozilla.org/en-US/Firefox/Headless_mode
JavaScript
71
star
48

developer-portal

The code that generates the MDN Web Docs Developer Portal.
Python
61
star
49

archived-content

Archived MDN Web Docs content that is not actively maintained or frequently built
HTML
58
star
50

voice-change-o-matic-float-data

Web Audio API-powered voice changer and visualizer
JavaScript
56
star
51

mdn-app-template

[UNMAINTAINED] A simple template for writing web apps into, to save you some time when experimenting. Used in MDN web app demos. See https://developer.mozilla.org/en-US/docs/Web/Apps/App_coding_guidelines#Apps_template for more information on what this template contains.
CSS
55
star
52

markdown

MDN Web Docs tool to covert HTML to Markdown
JavaScript
53
star
53

infra

(Deprecated) MDN Web Docs Infrastructure scripts and configuration
HCL
53
star
54

rumba

The clean kuma (๐Ÿค–๐Ÿงน)
Rust
49
star
55

learning-area-pt-br

The MDN Learning Area code examples translated into Brazilian Portuguese.
HTML
42
star
56

wp-promote-mdn

WordPress plugin automatically links keywords and phrases to MDN.
PHP
35
star
57

crossbrowser-testing-lab

Mozilla's Cross-Browser Testing Lab
32
star
58

battery-quickstart-starter-template

[UNMAINTAINED] The starting state of the example built up in the "Your first app" tutorial found in the Mozilla Developer Network open web app Quickstart article.
CSS
32
star
59

indexeddb-examples

Code examples that accompany the MDN IndexedDB documentation
JavaScript
31
star
60

workflows

Reusable GitHub Actions workflows
29
star
61

houdini-examples

CSS Houdini examples relating to MDN content.
HTML
28
star
62

sphinx-theme

(Deprecated) Make Sphinx docs look like MDN
HTML
28
star
63

pab

MDN Web Docs Product Advisory Board
HTML
26
star
64

ansible-jenkins

(Deprecated) Jenkins ansible playbook
Jinja
26
star
65

mdn.dev-2019

(Deprecated) Content for https://mdn.dev
JavaScript
24
star
66

browser-api-demo

A simple demo to show usage of the Mozilla Browser API. See https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API for more details.
JavaScript
23
star
67

addon-sdk-content-scripts

DEPRECATED | Use WebExtensions instead | Add-ons demonstrating how to use content scripts in the Add-on SDK.
JavaScript
23
star
68

stumptown-content

JavaScript
22
star
69

browsercompat

API for browser compatibility data on developer.mozilla.org
Python
22
star
70

web-tech-games

Interactive diagram showing what parts of the web technology stack can used for different purposes when creating games. Includes links to more information about each.
HTML
21
star
71

mdn-dinocons

A scalable set of icons for use across Mozilla Developer websites
20
star
72

insights

The repo that powers MDN Web Docs Insights.
HTML
19
star
73

world-clock

An Ember-based app, built as a sample to demonstrate Ember/Ember CLI and modern web architecture. This goes along with the article series found at https://developer.mozilla.org/en-US/Apps/Build/Modern_web_app_architecture.
JavaScript
19
star
74

fibonacci-worker

A web worker that calculates fibonacci numbers.
HTML
18
star
75

content-kit-template

This is the repo to fork or clone when creating a new MDN Content Kit.
HTML
17
star
76

shared-assets

A repository for media and assets to be used across MDN Web Docs
Mermaid
16
star
77

mdn-fiori

MDN Web Docs Front-End style guide
JavaScript
16
star
78

beginning-programming-content-kit

This is a Content Kit for people who want to teach programming to beginners.
HTML
16
star
79

.github

MDN Web Docs public organization profile
13
star
80

repl-panel

This add-on lets you send remote debugging protocol requests to the debugging server, and displays the response.
JavaScript
13
star
81

short-descriptions

Short descriptions of web platform features, for flexible usage in applications.
JavaScript
12
star
82

audio-channels-demo

A demo to show how the AudioChannels API works, at a basic level
JavaScript
12
star
83

mdn-storybook

UI components for MDN Web Docs
JavaScript
12
star
84

perf-examples

Examples related to MDN performance documentation; see https://developer.mozilla.org/en-US/docs/web/Performance
JavaScript
11
star
85

doc-linter-webextension

Webextension to lint MDN documents
JavaScript
10
star
86

webalyzer

[UNMAINTAINED] Collects web code for analysis and reporting.
Python
10
star
87

battery-quickstart-finished-example

[UNMAINTAINED] The finished version of the example built up in the "Your first app" tutorial found in the Mozilla Developer Network open web app Quickstart article.
JavaScript
10
star
88

community-meetings

A place for agendas and minutes from regular MDN community meetings
9
star
89

whitestorm-demo

A simple demo showing usage of the Whitestorm.js 3D web library.
HTML
9
star
90

browser-compat-toolkit

Toolkit for visualizing and editing MDN's browser compatibility data
JavaScript
9
star
91

e10s-example-addons

Examples showing how to port add-ons to be e10s-compatible
JavaScript
9
star
92

viewsourceconf

Repo for View Source Conference site
HTML
8
star
93

museum

A historic collection of MDN Web Docs content and examples
JavaScript
8
star
94

project-template

A project template to use for new MDN GitHub repositories
7
star
95

imsc-examples

Repository for examples to go along with MDN IMSC documentation.
HTML
7
star
96

todo-react-build

Live version of our sample todo app built with the React/ReactDOM framework.
HTML
7
star
97

retired-content

Content previously, but no longer displayed on MDN Web Docs.
HTML
7
star
98

ai-feedback

Feedback about AI Help
7
star
99

doc-linter-rules

Linting rules used to lint MDN Web Documents
JavaScript
6
star
100

helm-charts

DEPRECATED: Kubernetes Helm charts for the Mozilla Developer Network (MDN).
Smarty
5
star