@mdn/browser-compat-data
Browser compatibility data provided by MDN Web Docs
Last updated 2 years ago by schalkneethling .
CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @mdn/browser-compat-data 
SYNC missed versions from official npm registry.

@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...

// ESM Wrapper for older NodeJS versions (NodeJS v12+)
import bcd from '@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' };

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

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

Current Tags

  • 5.2.5                                ...           latest (2 years ago)

97 Versions

  • 5.2.5                                ...           2 years ago
  • 5.2.4                                ...           2 years ago
  • 5.2.3                                ...           2 years ago
  • 5.2.2                                ...           2 years ago
  • 5.2.1                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.10                                ...           2 years ago
  • 5.1.9                                ...           2 years ago
  • 5.1.8                                ...           2 years ago
  • 5.1.7                                ...           2 years ago
  • 5.1.6                                ...           2 years ago
  • 5.1.5                                ...           2 years ago
  • 5.1.4                                ...           2 years ago
  • 5.1.3                                ...           2 years ago
  • 5.1.2                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.3                                ...           3 years ago
  • 5.0.2                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.2.1                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.20                                ...           3 years ago
  • 4.1.19                                ...           3 years ago
  • 4.1.18                                ...           3 years ago
  • 4.1.17                                ...           3 years ago
  • 4.1.16                                ...           3 years ago
  • 4.1.15                                ...           3 years ago
  • 4.1.14                                ...           3 years ago
  • 4.1.13                                ...           3 years ago
  • 4.1.12                                ...           3 years ago
  • 4.1.11                                ...           3 years ago
  • 4.1.10                                ...           3 years ago
  • 4.1.9                                ...           3 years ago
  • 4.1.8                                ...           3 years ago
  • 4.1.7                                ...           3 years ago
  • 4.1.6                                ...           3 years ago
  • 4.1.5                                ...           3 years ago
  • 4.1.4                                ...           3 years ago
  • 4.1.3                                ...           3 years ago
  • 4.1.2                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.12                                ...           3 years ago
  • 4.0.11                                ...           3 years ago
  • 4.0.10                                ...           3 years ago
  • 4.0.9                                ...           3 years ago
  • 4.0.8                                ...           3 years ago
  • 4.0.7                                ...           3 years ago
  • 4.0.6                                ...           3 years ago
  • 4.0.5                                ...           3 years ago
  • 4.0.4                                ...           3 years ago
  • 4.0.3                                ...           3 years ago
  • 4.0.2                                ...           3 years ago
  • 4.0.1                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.3.14                                ...           3 years ago
  • 3.3.13                                ...           3 years ago
  • 3.3.12                                ...           3 years ago
  • 3.3.11                                ...           3 years ago
  • 3.3.10                                ...           3 years ago
  • 3.3.9                                ...           3 years ago
  • 3.3.8                                ...           3 years ago
  • 3.3.7                                ...           4 years ago
  • 3.3.6                                ...           4 years ago
  • 3.3.5                                ...           4 years ago
  • 3.3.4                                ...           4 years ago
  • 3.3.3                                ...           4 years ago
  • 3.3.2                                ...           4 years ago
  • 3.3.1                                ...           4 years ago
  • 3.3.0                                ...           4 years ago
  • 3.2.4                                ...           4 years ago
  • 3.2.3                                ...           4 years ago
  • 3.2.2                                ...           4 years ago
  • 3.2.1                                ...           4 years ago
  • 3.2.0                                ...           4 years ago
  • 3.1.3                                ...           4 years ago
  • 3.1.2                                ...           4 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.6                                ...           4 years ago
  • 3.0.5                                ...           4 years ago
  • 3.0.4                                ...           4 years ago
  • 3.0.3                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.7                                ...           4 years ago
  • 2.0.6                                ...           4 years ago
  • 2.0.5                                ...           4 years ago
  • 2.0.4                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 2.0.0-1                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |