or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

data-structure.mdindex.mdquery-navigation.mdsupport-analysis.mdtypes.md

data-structure.mddocs/

0

# Data Structure

1

2

The Browser Compat Data package provides access to a comprehensive, hierarchically organized dataset containing browser compatibility information for web technologies.

3

4

## Capabilities

5

6

### Main Data Object

7

8

The default export provides the complete browser compatibility dataset.

9

10

```typescript { .api }

11

/**

12

* Main browser compatibility data object containing all compatibility information

13

* organized by technology category

14

*/

15

const bcd: CompatData;

16

17

interface CompatData {

18

/** Package metadata including version and build timestamp */

19

__meta: {

20

version: string;

21

timestamp: string;

22

};

23

/** Web API interfaces, methods, properties, and events */

24

api: { [key: string]: Identifier };

25

/** Browser information, releases, and engine data */

26

browsers: { [key: string]: BrowserStatement };

27

/** CSS properties, selectors, at-rules, and functions */

28

css: { [key: string]: Identifier };

29

/** HTML elements, attributes, and global attributes */

30

html: { [key: string]: Identifier };

31

/** HTTP headers, status codes, methods, and features */

32

http: { [key: string]: Identifier };

33

/** JavaScript language features and built-in objects */

34

javascript: { [key: string]: Identifier };

35

/** Web App Manifest properties and PWA features */

36

manifests: { [key: string]: Identifier };

37

/** MathML elements and attributes */

38

mathml: { [key: string]: Identifier };

39

/** SVG elements, attributes, and features */

40

svg: { [key: string]: Identifier };

41

/** WebAssembly instructions, types, and features */

42

webassembly: { [key: string]: Identifier };

43

/** WebDriver automation commands and capabilities */

44

webdriver: { [key: string]: Identifier };

45

/** Browser extension APIs across different browsers */

46

webextensions: { [key: string]: Identifier };

47

}

48

```

49

50

**Usage Example:**

51

52

```typescript

53

import bcd from '@mdn/browser-compat-data';

54

55

// Access package metadata

56

console.log(bcd.__meta.version); // "7.1.2"

57

58

// Access CSS flexbox support

59

const flexbox = bcd.css.properties.display.__compat.support;

60

console.log(flexbox.chrome.version_added); // "29"

61

62

// Check if a feature is experimental

63

const isExperimental = bcd.api.CSSMarginRule.__compat.status.experimental;

64

console.log(isExperimental); // true

65

```

66

67

### Feature Identifiers

68

69

Features in the dataset are represented by Identifier objects that may contain sub-features and compatibility statements.

70

71

```typescript { .api }

72

/**

73

* Represents a feature tree node that may contain sub-features and compatibility data

74

*/

75

interface Identifier {

76

/** Compatibility statement for this feature */

77

__compat?: CompatStatement;

78

/** Sub-features or related properties */

79

[key: string]: Identifier | CompatStatement | undefined;

80

}

81

```

82

83

### Browser Information

84

85

Browser data contains detailed information about browser releases, engines, and capabilities.

86

87

```typescript { .api }

88

/**

89

* Describes a browser including its releases, engine information, and capabilities

90

*/

91

interface BrowserStatement {

92

/** Human-readable browser name */

93

name: string;

94

/** Browser type classification */

95

type?: BrowserType;

96

/** All browser releases with version information */

97

releases: { [version: string]: ReleaseStatement };

98

/** Whether browser accepts feature flags */

99

accepts_flags?: boolean;

100

/** Whether browser accepts webextensions */

101

accepts_webextensions?: boolean;

102

/** Preview browser name for development versions */

103

preview_name?: string;

104

/** Upstream browser this one is based on */

105

upstream?: string;

106

}

107

108

/**

109

* Browser type classification

110

*/

111

type BrowserType = "desktop" | "mobile" | "xr" | "server";

112

113

/**

114

* Information about a specific browser release

115

*/

116

interface ReleaseStatement {

117

/** Release date in YYYY-MM-DD format */

118

release_date?: string;

119

/** Release notes URL */

120

release_notes?: string;

121

/** Release status */

122

status: "retired" | "current" | "exclusive" | "beta" | "nightly" | "esr" | "planned";

123

/** Rendering engine name */

124

engine: string;

125

/** Engine version for this release */

126

engine_version: string;

127

}

128

```

129

130

**Usage Example:**

131

132

```typescript

133

import bcd from '@mdn/browser-compat-data';

134

135

// Get Chrome browser information

136

const chrome = bcd.browsers.chrome;

137

console.log(chrome.name); // "Chrome"

138

console.log(chrome.type); // "desktop"

139

140

// Check a specific Chrome release

141

const chrome90 = chrome.releases["90"];

142

console.log(chrome90.engine); // "Blink"

143

console.log(chrome90.status); // "retired"

144

```

145

146

### Compatibility Statements

147

148

Compatibility statements contain the core browser support information for features.

149

150

```typescript { .api }

151

/**

152

* Contains support data and metadata for a web platform feature

153

*/

154

interface CompatStatement {

155

/** Human-readable description of the feature */

156

description?: string;

157

/** Specification URL(s) for this feature */

158

spec_url?: string | string[];

159

/** Tags for categorization and web-features integration */

160

tags?: string[];

161

/** Browser support information */

162

support: SupportBlock;

163

/** Standardization and implementation status */

164

status?: StatusStatement;

165

/** Source file path in the repository */

166

source_file?: string;

167

}

168

169

/**

170

* Browser support information mapping browser names to support statements

171

*/

172

type SupportBlock = Partial<Record<BrowserName, SupportStatement>>;

173

174

/**

175

* Support information for a specific browser (single statement or array)

176

*/

177

type SupportStatement = SimpleSupportStatement | SimpleSupportStatement[];

178

179

/**

180

* Detailed browser support information

181

*/

182

interface SimpleSupportStatement {

183

/** Version when support was added (string version, true, false, or null) */

184

version_added: VersionValue;

185

/** Version when support was removed */

186

version_removed?: VersionValue;

187

/** Required prefix for the feature */

188

prefix?: string;

189

/** Alternative name the feature was known by */

190

alternative_name?: string;

191

/** Required flags to enable the feature */

192

flags?: FlagStatement[];

193

/** Implementation tracking URL */

194

impl_url?: string;

195

/** Additional notes about support */

196

notes?: string | string[];

197

/** Whether support is only partial */

198

partial_implementation?: boolean;

199

}

200

201

/**

202

* Version value - string for specific versions, boolean for general support

203

*/

204

type VersionValue = string | boolean | null;

205

206

/**

207

* Information about feature flags required to enable functionality

208

*/

209

interface FlagStatement {

210

/** Flag type */

211

type: "preference" | "compile_flag" | "runtime_flag";

212

/** Flag name */

213

name: string;

214

/** Value to set for the flag */

215

value_to_set?: string;

216

}

217

218

/**

219

* Standardization and implementation status

220

*/

221

interface StatusStatement {

222

/** Whether the feature is experimental */

223

experimental?: boolean;

224

/** Whether the feature is on the standards track */

225

standard_track?: boolean;

226

/** Whether the feature is deprecated */

227

deprecated?: boolean;

228

}

229

```

230

231

**Usage Example:**

232

233

```typescript

234

import bcd from '@mdn/browser-compat-data';

235

236

// Get fetch API compatibility

237

const fetchCompat = bcd.api.fetch.__compat;

238

239

// Check Chrome support

240

const chromeSupport = fetchCompat.support.chrome;

241

console.log(chromeSupport.version_added); // "42"

242

243

// Check if feature is experimental

244

console.log(fetchCompat.status?.experimental); // false

245

246

// Look for features with flags

247

const featureWithFlags = bcd.css.properties["container-type"].__compat;

248

const chromeFlags = featureWithFlags.support.chrome.flags;

249

if (chromeFlags) {

250

console.log(chromeFlags[0].name); // Flag name if present

251

}

252

```

253

254

### Data Organization

255

256

The data is hierarchically structured with consistent patterns across all categories:

257

258

- **Category Level**: Top-level technology categories (api, css, html, etc.)

259

- **Interface/Property Level**: Specific interfaces, properties, or elements

260

- **Feature Level**: Individual methods, values, or attributes

261

- **Compatibility Level**: `__compat` objects containing support data

262

263

For example, the path `bcd.api.fetch.json` represents:

264

- Category: `api` (Web APIs)

265

- Interface: `fetch` (Fetch API)

266

- Feature: `json` (json method)

267

- Compatibility: `__compat` (browser support data)

268

269

This consistent structure enables programmatic access using dot notation and makes the data predictable for automated processing.