- Notifications
You must be signed in to change notification settings - Fork2
This repository contains compatibility data for Web technologies as displayed on MDN
License
chrisdavidmills/browser-compat-data
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
https://github.com/mdn/browser-compat-data
Thebrowser-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 asMDN Web Docs, CanIUse, Visual Studio Code, WebStorm andmore.
Read how this project isgoverned.
Chat with us on Matrix atchat.mozilla.org#mdn!
Are you interested in contributing to this project? Check out theContributing to browser-compat-data documentation.
Tip
Looking for something? Consult thealphabetical index of the project documentation.
You can install@mdn/browser-compat-data as a node package.
npm install @mdn/browser-compat-data# ...or...yarn add @mdn/browser-compat-dataThen, you can import BCD into your project with eitherimport orrequire():
// ESM with Import Attributes (NodeJS 20+)importbcdfrom'@mdn/browser-compat-data'with{type:'json'};// ...or...const{default:bcd}=awaitimport('@mdn/browser-compat-data',{with:{type:'json'},});// ...or...// ESM with Import Assertions (NodeJS 16+)importbcdfrom'@mdn/browser-compat-data'assert{type: 'json'};// ...or...const{default:bcd}=awaitimport('@mdn/browser-compat-data',{assert:{type:'json'},});// ...or...// ESM Wrapper for older NodeJS versions (NodeJS v12+)importbcdfrom'@mdn/browser-compat-data/forLegacyNode';// ...or...const{default:bcd}=awaitimport('@mdn/browser-compat-data/forLegacyNode');// ...or...// CommonJS Module (Any NodeJS)constbcd=require('@mdn/browser-compat-data');
You can import@mdn/browser-compat-data using a CDN.
// ESM with Import Attributes (Deno 1.37+)importbcdfrom'https://unpkg.com/@mdn/browser-compat-data'with{type:'json'};// ...or...const{default:bcd}=awaitimport('https://unpkg.com/@mdn/browser-compat-data',{with:{type:'json'},});// ...or...// ESM with Import Assertions (Deno 1.17+)importbcdfrom'https://unpkg.com/@mdn/browser-compat-data'assert{type: 'json'};// ...or...const{default:bcd}=awaitimport('https://unpkg.com/@mdn/browser-compat-data',{assert:{type:'json'},});// ...or...// Fetch Method (Deno 1.0+)constbcd=awaitfetch('https://unpkg.com/@mdn/browser-compat-data').then((response)=>response.json(),);
You can obtain the raw compatibility data for@mdn/browser-compat-data using a CDN and loading thedata.json file included in releases.
https://unpkg.com/@mdn/browser-compat-data/data.jsonOnce you have imported BCD, you can access the compatibility data for any feature by accessing the properties of the dictionary.
// Grab the desired support statementconstsupport=bcd.css.properties.background.__compat;// returns a compat data object (see schema)// You may use any syntax to obtain dictionary itemsconstsupport=bcd['api']['Document']['body']['__compat'];
BCD exports TypeScript type definitions. Type definitions are automatically generated from theschema definitions.
The@mdn/browser-compat-data package contains a tree of objects, with support and browser data objects at their leaves. There are over 15,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 theschema definitions.
Apart from the explicitly documented objects below, feature-level support data may change at any time. SeeSemantic versioning policy for details.
The package contains the following top-level objects:
An object containing the following package metadata:
version- the package versiontimestamp- the timestamp of when the package version was built
Data forWeb API features.
Data for browsers and JavaScript runtimes. See thebrowser schema for details.
Data forCSS 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
Data forHTML features, including:
elements- Elementsglobal_attributes- Global attributes
Data forHTTP features, including:
headers- Request and response headersmethods- Request methodsstatus- Status codes
Data for JavaScript language features, including:
builtins- Built-in objectsclasses- Class definition featuresfunctions- Function featuresgrammar- Language grammaroperators- Mathematical and logical operatorsstatements- Language statements and expressions
webapp- Web App manifest keys
Data forMathML features, including:
elements- Elements
Data forSVG features, including:
attributes- Attributeselements- Elements
Data forWebAssembly features.
Data forWebDriver features, including:
bidi- WebDriver BiDi protocolclassic- WebDriver Classic protocol
Data forWebExtensions features, including:
api- WebExtension-specific APIsmanifest-manifest.jsonkeys
For the purposes ofsemantic versioning (SemVer), the public API consists of:
- The high-level namespace objects documented inPackage 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, pleaseopen an issue.
Now that you know what this projectis, let's mention what this projectisn't. This project is not:
- An extensive description of every possible detail about a feature in a browser. We do not track UI changes,irrelevant features orirrelevant flag data.
- A source for custom features added by web frameworks (e.g. React, Vue) or corporate runtimes (e.g. AWS Lambda, Azure Functions).
- A documentation of screen reader compatibility; for screen reader compatibility, check outhttps://a11ysupport.io/ instead.
- The location where Baseline data is hosted; while Baseline pulls from BCD, the Baseline data is managed by the W3C WebDX Community Group on their ownGitHub repo.
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, pleasefile a bug.
Thank you for your interest in contributing to this project! SeeContributing to browser-compat-data for more information.
Here are some projects using the data, as annpm module or directly:
- Add-ons Linter - NPM package that checks add-ons for features that aren't supported by the targeted Firefox version. Used byaddons.mozilla.org and theweb-ext tool.
- ast-metadata-inferer - NPM package that annotates JavaScript AST nodes with metadata derived from BCD data. Used byeslint-plugin-compat.
- BCD Watch - Website that shows a weekly report of BCD changes.
- caniuse - Website that shows browser support tables based on caniuse and BCD data.
- caniuse-lite - NPM package that republishes BCD data in the caniuse format.
- CanIUse Embed - Service that allows embedding caniuse (including BCD data) into any website.
- CanIWebView - Website that shows support tables based on BCD data for WebViews and mobile browsers for comparison.
- css-declaration-sorter - NPM package that sorts CSS properties alphabetically.
- csstype - NPM package that publishes strict TypeScript/Flow types for CSS.
- Compat Report - Firefox Add-on that shows BCD data for the current site in the developer tools.
- compat-tester - NPM package that scans HTML, CSS and JS files for compatibility issues.
- JetBrains WebStorm - IDE that uses BCD data tocheck browser support of used CSS properties (see2019.1 releasenotes) bygenerating feature lists with support data.
- JSR - Package registry that uses BCD data togenerate a list of web builtins.
- Mozilla Firefox - Web browser that uses BCD data in the DevTools to showCSS property compatibility data mapped against alist of non-retired browsers.
- TypeScript - Programming language that uses BCD data togenerate DOM typings.
- Visual Studio Code - IDE that uses BCD to show compatibility information forCSS features (seeVSCode 1.25 release notes), and toextract MDN urls for HTML elements.
- web-features - NPM package that publishes web feature groups with Baseline statuses based on BCD data.
- web-features-explorer - Website that visualizes web features by Baseline status and month.
webhint.io- Tool that uses BCD to checks CSS and HTML for unsupported features (see@hint/utils-compat-datapackage).
Thanks to:
![]() TheBrowserStack Open Source Program for testing services | ![]() Sauce Labs Open Source for testing services | ![]() LambdaTest Open Source for testing services |
About
This repository contains compatibility data for Web technologies as displayed on MDN
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- JSON98.2%
- TypeScript1.8%


