JavaScript, a.k.a. Web ECMAScript

Living Standard — 27 April 2016

This Version:
https://javascript.spec.whatwg.org/
Participate:
File a bug (but check the list of open bugs first)
IRC: #whatwg on Freenode
Version History:
https://github.com/whatwg/javascript
Editor:
Mathias Bynens
Translation (non-normative)
日本語

Table of Contents

  1. 1 Goals
  2. 2 Conformance
  3. 3 Terminology
  4. 4 Annex B
  5. 5 Date
    1. 5.1 Date.UTC(year, month, date, hours, minutes, seconds, ms)
  6. 6 RegExp
    1. 6.1 Octal escapes in regular expression literals
    2. 6.2 RegExp.$1-$9
    3. 6.3 RegExp.lastMatch / RegExp["$&"]
  7. 7 Function
    1. 7.1 Function.prototype.toString()
  8. References
  9. Acknowledgments

1 Goals

This specification aims to document the differences between the ECMAScript specification and the compatibility and interoperability requirements for ECMAScript implementations in web browsers. The ultimate goal of this document is to upstream its contents to the ECMAScript standard. [ECMASCRIPT]

2 Conformance

Everything in this specification is normative except for examples, notes, and sections marked as non-normative.

A JavaScript implementation must be a conforming implementation of ECMAScript with the extensions described in this document. [ECMASCRIPT]

A user agent must also be a conforming implementation of HTML, if applicable. [HTML]

Script authors must not depend on the extensions defined in this specification.

3 Terminology

The key words “must” and “should” in this document are to be interpreted as described in RFC 2119. [RFC2119]

Special symbols in this document are identified using their Unicode code points and names. [UNICODE]

When this specification uses the term ECMAScript character, it means a 16-bit unsigned value used to represent a single 16-bit unit of text. [ECMASCRIPT]

4 Annex B

JavaScript implementations must fully implement Annex B of the ECMAScript specification.

5 Date

Tests are available: https://mathias.html5.org/tests/javascript/date/.

5.1 Date.UTC(year, month, date, hours, minutes, seconds, ms)

When called with fewer than two arguments, Date.UTC must return NaN.

6 RegExp

6.1 Octal escapes in regular expression literals

The octal escape sequence syntax for string literals as described in Annex B of the ECMAScript spec must be supported, and must also apply to regular expression literals, even in strict mode code.

/\123/.test('S'); // true

6.2 RegExp.$1-$9

After a regexp is executed the RegExp constructor object has properties $1...$9 which are assigned the values of the first 9 match groups from the previous regexp.

6.3 RegExp.lastMatch / RegExp["$&"]

7 Function

Tests are available: https://mathias.html5.org/tests/javascript/function/.

7.1 Function.prototype.toString()

TODO

References

[ECMASCRIPT]
ECMAScript Language Specification. ECMA.
[HTML]
HTML, Ian Hickson. WHATWG.
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels, Scott Bradner. IETF.
[UNICODE]
Unicode Standard. Unicode Consortium.

Acknowledgments

Thanks to Anne van Kesteren, Aryeh Gregor, Daniel Ehrenberg, David Håsäther, Domenic Denicola, James Graham, John-David Dalton, Masatoshi Kimura, Ms2ger, Simon Pieters, Simon Sapin, Steven Levithan, Mark ‘Tarquin’ Wilton-Jones, and Tom Schuster for their useful comments.

Special thanks to James Graham for collecting and documenting most of these requirements on the WHATWG Wiki, and Juriy ‘kangax’ Zaytsev (Юрий Зайцев) for his ECMAScript Extensions Compatibility Table.