Generated by GPT-5-mini| WebIDL | |
|---|---|
| Name | WebIDL |
| Caption | Interface description language for web APIs |
| Developer | World Wide Web Consortium |
| Released | 2011 |
| Latest release | Living Standard |
| Genre | Interface description language |
WebIDL is an interface description language designed to specify APIs that are exposed to World Wide Web scripting environments. It describes how objects, interfaces, operations, attributes, and callbacks are represented and how they map to programming languages implemented by user agents produced by organizations such as Mozilla Foundation, Google, Microsoft, and Apple Inc.. WebIDL serves as a normative bridge between specification authors at bodies like the World Wide Web Consortium and engine implementers at projects such as Chromium, Gecko, and WebKit.
WebIDL provides a formal grammar and semantic rules for declaring APIs that are intended to be usable from ECMAScript engines like V8 (JavaScript engine), SpiderMonkey, and JavaScriptCore. It complements other standards work from organizations such as the Internet Engineering Task Force and the Ecma International technical committees that maintain ECMAScript. Specification authors for web standards produced by groups including the W3C Web Applications Working Group and the WHATWG express object models, typed arrays, and other interfaces in WebIDL so that implementers at projects like Blink and Servo have a common reference. WebIDL definitions are used in prominent specifications such as the HTML Living Standard, DOM Standard, WebRTC, and Web Storage.
The WebIDL syntax is a domain-specific notation derived from traditional IDLs used by projects like CORBA and the Microsoft IDL. It includes declarations for primitive and composite types: Boolean, integer types, floating point types, DOMString, ByteString, ArrayBuffer, and typed arrays that are referenced in specifications like Canvas API and WebGL. Complex types include sequences, records, unions, and nullable variants, allowing mappings to language-specific constructs in implementations maintained at organizations such as Google LLC and Mozilla Foundation. The grammar defines keywords, extended attributes, and annotations used in standards like SVG and IndexedDB.
WebIDL expresses object models using interface declarations, which mirror DOM concepts found in the DOM Standard and in historical work from groups like the W3C CSS Working Group. Interfaces can inherit from other interfaces, enabling prototype chains that align with behaviors in engines such as V8 and JavaScriptCore. Multiple inheritance is not supported; instead, mixin patterns and interface implements relationships are used—patterns also seen in specifications like Geolocation API and Battery Status API. Interfaces are named and used across specifications authored by consortia including the W3C Community Group and the WHATWG.
Members of interfaces are declared as attributes or operations. Attributes describe state with getter/setter semantics, analogous to properties in ECMAScript engines like Node.js when embedded in server environments. Operations represent callable methods with overload resolution similar to function signatures defined by experts at Ecma International committees. WebIDL also defines callback and iterable constructs used in concurrency and event patterns found in WebSockets, Service Worker APIs, and other work by organizations such as IETF and W3C Web Performance Working Group. Extended attributes allow specification of binding behavior, legacy prefixes, and versioning annotations used by industry projects like Blink.
A central purpose of WebIDL is to define language bindings and mappings between the abstract interface and concrete runtime representations in target languages. The most common mapping is to ECMAScript (JavaScript), with detailed rules addressing conversions, exceptions, and coercions implemented in engines such as V8 (JavaScript engine), SpiderMonkey, and JavaScriptCore. Other mappings have been explored in contexts involving Rust-based engines like Servo, or bindings produced by language projects associated with Khronos Group work on WebGL. The specification codifies how types like sequences map to arrays in Node.js and how exceptions map to host-language error models managed by vendors such as Microsoft and Apple Inc..
WebIDL is used directly in many web platform specifications, and implementers often consume IDL files to generate glue code, bindings, and tests. Tooling for WebIDL ranges from generators maintained in projects like Mozilla Add-ons tooling to custom parsers used by corporations such as Google LLC and Microsoft. Engines like Blink, Gecko, and WebKit embed WebIDL-derived bindings into their codebases to ensure consistent behavior across browsers such as Google Chrome, Mozilla Firefox, and Safari (web browser). Testing ecosystems including WPT (Web Platform Tests) use WebIDL agreements to create normative test vectors for conformance by vendors and research institutions.
The WebIDL effort originated from the need to harmonize interface definitions across web specifications, with formalization work coordinated by the W3C Web Platform Working Group and collaboration from implementers at Apple Inc., Google LLC, Microsoft, and Mozilla Foundation. Its evolution paralleled developments in ECMAScript standards and the emergence of living standards maintained by the WHATWG and W3C. Milestones include integration into the HTML5 ecosystem, adoption by the DOM Standard, and continued maintenance as a living specification overseen by the World Wide Web Consortium. The process has involved public discussion venues, issue trackers hosted by organizations like GitHub, and contributions from academic groups and industry labs.