Перевод не завершен. Пожалуйста, помогите перевести эту статью с английского.
Ниже представлен список изменений для возможносте JavaScript в соответствующей версии Firefox.
Firefox 41
Date.prototype
is now an ordinary object, not aDate
instance anymore (bug 861219).Date.prototype.toString
is now a generic method (bug 861219).Symbol.species
has been added (bug 1131043).Map[@@species]
andSet[@@species]
getters have been added (bug 1131043).- Non-standard let expression support has been dropped (bug 1023609).
- Destructured parameters with default value assignment are now supported (bug 1018628).
- Per ES6, curly braces are required for method definitions. Syntax without them will fail from now on (bug 1150855).
- Method definitions (except for generator methods) are not constructable anymore (bug 1059908 and bug 1166950).
- As part of ES6 specification compliance, parenthesized destructuring patterns, like
([a, b]) = [1, 2]
or({a, b}) = { a: 1, b: 2 }
, are now considered invalid and will throw aSyntaxError
. See Jeff Walden's blog post for more details. - The
new.target
syntax has been added (bug 1141865).
Смотрите также:
Firefox 40
- Unreachable code after
return
statement (including unreachable expression after semicolon-less return statements) will now show a warning in the console (bug 1005110, bug 1151931). Symbol.match
has been added (bug 1054755).- Passing an object which has a property named
Symbol.match
with a truthy value toString.prototype.startsWith
,String.prototype.endsWith
, andString.prototype.contains
now throws aTypeError
(bug 1054755). RegExp
function returns pattern itself if called withoutnew
and pattern object has a property namedSymbol.match
with a truthy value, and the pattern object'sconstructor
property equals toRegExp
function. (bug 1147817).- Support for the non-standard JS1.7 destructuring for-in has been dropped (bug 1083498).
- Non-standard initializer expressions in for...in loops are now ignored and will present a warning in the console. (bug 748550 and bug 1164741).
\u{xxxxxx}
Unicode code point escapes have been added (bug 320500).String.prototype.contains
has been replaced withString.prototype.includes
,String.prototype.contains
is kept as an alias (bug 1102219).- If the
DataView
constructor is called as a function without thenew
operator, aTypeError
is now thrown as per the ES6 specification. - An issue regressed in Firefox 21, where proxyfied arrays without the
get
trap were not working properly, has been fixed. If theget
trap in aProxy
was not defined,Array.length
returned0
and theset
trap didn't get called. A workaround was to add theget
trap even if was not necessary in your code. This issue has been fixed now (bug 895223). WeakMap.prototype
andWeakSet.prototype
have been updated to be just ordinary objects, per ES6 specification (bug 1055473).
Смотрите также:
Firefox 39
- The
RegExp
constructor no longer throws when the first argument is aRegExp
and the secondflags
argument is present (bug 1108949). - The
Object.prototype.__noSuchMethod__
property is now deprecated and throws a console warning (see bug 1140428 and this platform announcement). - The implementation of the
Proxy
object has been updated to comply more with the ES6 specification:- The
defineProperty
andset
handlers now need to explicitly returntrue
to be successful, otherwise aTypeError
exception will be thrown in strict mode (bug 1132522). - If the
window
object is set as the target, those handlers will now throw aTypeError
(bug 828137).
- The
- When using arrow functions (
=>
), a line terminator (\n
) is no longer allowed after arrow function arguments (() \n => {}
) (bug 1141392). RegExp.prototype.toString
is now a generic function (bug 1079919).- The non-standard
flags
argument ofString.prototype.match()
,String.prototype.search()
, andString.prototype.replace()
is now deprecated and throws a console warning (bug 1142351). - The try/catch behavior of
Object.assign()
has been removed to conform with the latest ES6 draft (bug 1103344).
Смотрите также:
Firefox 38
Generator.prototype.return()
is implemented (bug 1115868).Setter
with a rest parameter is now aSyntaxError
(bug 1089632).- The
name
property of functions is configurable now (bug 1084019). - Several
Array
methods have been implemented for typed arrays as well:- The
of()
andfrom()
methods (bug 896608). - The
forEach()
method (bug 1107645). - The
filter()
andmap()
methods (bug 1121936). - The
slice()
method (bug 1121935).
- The
- Duplicated parameter name is no longer allowed when rest-parameter is present (bug 1096376).
- Duplicated parameter name is no longer allowed in arrow functions (bug 1096377).
- Duplicated parameter name is no longer allowed in concise method definitions (bug 1096378).
- Warning is shown when
Map
/Set
/WeakMap
constructor is called withoutnew
(bug 1108930). - The
get
,has
, anddelete
methods ofWeakMap
objects no longer throw when thekey
parameter is not an object (bug 1127827). - The optional and non-standard second
fallback
parameter forWeakMap.prototype.get()
has been removed (bug 1127827). - When defining a generator method, "
set
" and "get
" are no longer invalid names (bug 1073809). RegExp.prototype.source
now returns "(?:)" instead of an empty string for empty regular expressions (bug 1130798).RegExp.prototype.source
andRegExp.prototype.toString()
now escape regular expression patterns properly (e.g. line terminators, "\n") (bug 1130860).- The
Regexp
global
,ignoreCase
,multiline
, andsticky
properties are now prototype accessor properties rather than own data properties ofRegExp
instances (bug 1120169). - The
RegExp.prototype.source
property is now prototype accessor property rather than own data property ofRegExp
instances (bug 1120169). Available only in non-Release version, due to bug 1150297. Function.prototype.toString()
now throws forProxy
objects (bug 1100936).
Смотрите также:
Firefox 37
- The
Map
,Set
,WeakMap
andWeakSet
constructors now ignore null iterable (bug 1092538). - The
Map
,Set
,WeakMap
andWeakSet
constructors now supports monkey-patchedprototype.set
orprototype.add
(bug 804279). - The Non-standard
String.prototype.quote()
method has been removed (bug 1103181). - The
RegExp.prototype.flags
property has been implemented (bug 1108467). - Several
Array
methods have been implemented for typed arrays as well:- The
every()
andsome()
methods (bug 1116390). - The
find()
andfindIndex()
methods (bug 1078975). - The
fill()
method (bug 1113722). - The
indexOf()
andlastIndexOf()
methods (bug 1107601). - The
join()
method (bug 1115817). - The
reduce()
andreduceRight()
methods (bug 1117350). - The
reverse()
method (bug 1111516). - The
keys()
,values()
, andentries()
methods (bug 1119217).
- The
- ES6 Proxy
enumerate
trap is implemented (bug 783829). - The
configurable
attribute of theFunction.length
property is nowtrue
per the ES6 specification (bug 911142). - The development of ParallelJS (PJS) has been discontinued due to the limited future prospects, little attention and code complexity. The experimental implementation that had been enabled only on the Nightly channel, including the
Array.prototype.mapPar
,filterPar
andreducePar
methods, has been completely removed.
Смотрите также:
Firefox 36
- The ECMAScript 6 Symbol data type has been enabled by default (was available in the Nightly channel since version 33) (bug 1066322):
- The old placeholder string
"@@iterator"
has been replaced with the real ES6 well-known symbolSymbol.iterator
for the iterable interface property key (bug 918828). - The spec-internal abstract operation
ToNumber(string)
now supports binary (0b
) and octal (0o
) literals, this is a potentially breaking change from ES5 (bug 1079120).Number("0b11")
now returns3
, notNaN
."0o11" == 9
now returnstrue
, notfalse
.
- The
const
declaration is now block-scoped and requires an initializer (bug 611388). It also can not be redeclared anymore (bug 1095439).{const a=1}; a;
now throws aReferenceError
and does not return1
anymore due to block-scoping.const a;
now throws aSyntaxError
("missing = in const declaration"
): An initializer is required.const a = 1; a = 2;
now also throws aSyntaxError
("invalid assignment to const a").
- The ES7 method
Array.prototype.includes
has been implemented, but for now, it is only enabled in Nightly builds (bug 1069063). - The
delete
operator now triggers the "temporal dead zone" when using withlet
andconst
(bug 1074571). - The non-standard
let
blocks andlet
expressions are deprecated and will now log a warning in the console. Do not use them anymore, they will be removed in the future. - WeakMap constructor now handles optional iterable argument (bug 1092537).
Смотрите также:
Firefox 35
- The "temporal dead zone" for
let
declarations has been implemented. In conformance with ES6let
semantics, the following situations
now throw errors. See also this newsgroup announcement and bug 1001090.- Redeclaring existing variables or arguments using
let
within the same scope in function bodies is now a syntax error. - Using a variable declared using
let
in function bodies before the declaration is reached and evaluated is now a runtime error.
- Redeclaring existing variables or arguments using
- ES6
Symbols
(only available in the Nightly channel) have been updated to conform with recent specification changes:String(Symbol("1"))
now no longer throws aTypeError
; instead a string ("Symbol(1)"
) gets returned (bug 1058396).
- The various TypedArray constructors now have as their
[[Prototype]]
a single function, denoted%TypedArray%
in ES6 (but otherwise not directly exposed). Each typed array prototype now inherits from%TypedArray%.prototype
. (%TypedArray%
and%TypedArray%.prototype
inherit fromFunction.prototype
andObject.prototype
, respectively, so that typed array constructors and instances still have the properties found on those objects.) Typed array function properties now reside on%TypedArray%.prototype
and work on any typed array. See TypedArray and bug 896116 for more information. - ES6 semantics for prototype mutations using object literals have been implemented (bug 1061853).
- Now only a single member notated as
__proto__:value
will mutate the[[Prototype]]
in the object literal syntax. - Method members like
__proto__() {}
will not overwrite the[[Prototype]]
anymore.
- Now only a single member notated as
Смотрите также:
Firefox 34
- The ES6 syntax for computed property names on object literals has been implemented (bug 924688).
- This includes getter and setter method names as well (bug 1048384) and can also be used with destructuring.
- The ES6 shorthand syntax for defining methods on objects has been implemented (bug 924672).
- The ES6
Object
methodObject.assign()
has been implemented (bug 937855). - ES6 template strings and the
String.raw()
method are now supported (bug 1038259, bug 1039774). - A new ES6 object
WeakSet
has been added (bug 792439). - ES6 Symbols (only available in the Nightly channel) have been updated to conform with recent specification changes (bug 1042602):
- When trying to convert a symbol to a number, a
TypeError
will be thrown now. - When using loose equality,
Object(sym) == sym
returnstrue
now.
- When trying to convert a symbol to a number, a
- The experimental
TypedArray.prototype.move()
method (only available in former Nightly and Aurora channels) has been replaced with the now implemented standard ES6TypedArray.prototype.copyWithin()
method (bug 1021379). - In strict mode, setting a duplicate property name in object literals will no longer throw a
SyntaxError
as per ES6 specification (bug 1041128). - In regular expressions (including
String.replace
), the matched text for a capturing group is nowundefined
instead of the empty string when that capturing group didn't get consulted because quantifiers prevented its exercise (see bug 369778 and this example code). Note that due to web compatibility, RegExp.$N will still return an empty string (bug 1053944). - The ES6 spread operator is now supported in destructuring (bug 933276).
- Destructuring now uses iterator protocol instead of array-like protocol (bug 933276).
- bug 978279). (
Смотрите также:
Firefox 33
- The non-standard method
Number.toInteger()
has been removed (bug 1022396). - The
Map.prototype.set()
,WeakMap.prototype.set()
andSet.prototype.add()
methods are now chainable, return their equivalent objects and no longerundefined
(bug 1031632). - A default parameter is evaluated before function declarations inside the function body, so those functions cannot be referred from default parameter (bug 1022962).
- Shorthand properties are now allowed in object literals: if not explicitly defined, property keys are initialized by variables of the same name. E.g.
function f(x, y) { return {x, y}; }
is equivalent tofunction f(x, y) { return {x: x, y: y}; }
(bug 875002). - The parsing of
yield
andyield*
has been updated to conform with the latest ES6 specification (bug 981599). - The non-standard
hasOwn
trap has been removed (bug 980565).
Смотрите также:
Firefox 32
- The following new ECMAScript 6 built-in methods got implemented:
See also:
Firefox 31
New ECMAScript 6 features implemented:
- New
Array
built-in:Array.prototype.fill()
(bug 911147) - New
Math
function:Math.clz32()
(bug 925123) - New
String
built-in:String.prototype.normalize()
is available in Firefox Desktop (bug 918987). - New
Object
methodObject.setPrototypeOf()
. - New
Number
constants:Number.MAX_SAFE_INTEGER
andNumber.MIN_SAFE_INTEGER
. - The ES6 Proxy
isExtensible
trap have been implemented (bug 978235).
See also:
Firefox 30
- New ES6-compatible array comprehensions
[for (item of iterable) item]
and generator comprehensions(for (item of iterable) item)
have been implemented (bug 979865). - Typed arrays are now extensible and support new named properties (bug 695438).
- The
Error.prototype.stack
property now contains column numbers (bug 762556) and has been improved when usingFunction()
andeval()
calls. This can help you to better debug minified or generated JavaScript code. - The
Promise.cast()
method has been renamed toPromise.resolve()
(bug 966348).
See also:
Firefox 29
- New ECMAScript 6 String methods:
String.prototype.codePointAt()
andString.prototype.fromCodePoint()
have been implemented (bug 918879). - The ECMAScript Internationalization API (ECMA-402) has been implemented and is now enabled by default in Firefox Desktop (bug 853301):
- To match the updated ECMAScript6 draft specification, the
Map
andSet
objects now treat-0
and+0
as the same when checking for key and value equality. Promise
has been enabled by default (bug 918806).- Completed generators now return an
IteratorResult
object instead of throwing (bug 958951). - A malformed JSON string parsed by
JSON.parse()
now yields a more detailed error message containing the line and column number that caused the parsing error. This is useful when debugging large JSON data. - The
ArrayBuffer.isView()
method has been added (bug 896105).
See also:
Firefox 28
- ECMAScript 6 (Harmony) implementation continues:
- New
Array
methods have been implemented:Array.prototype.entries()
andArray.prototype.keys()
(bug 894658).
- New
- A bug causing that
Object.getOwnPropertyNames()
did not see unresolved properties ofError
objects has been fixed (bug 724768).
See also:
Firefox 27
EcmaScript 6 (Harmony) implementation continues!
- The spread operator is now supported in Function calls (bug 762363).
- The mathematical function
Math.hypot()
has been implemented (bug 896264). - The
yield*
expression is now implemented (bug 666396). - The
MapIterator
,SetIterator
andArrayIterator
objects now match the specification (bug 881226). - for..of loops now expect the ES6 standard iterator protocol moving away from SpiderMonkey old iterator protocol using
StopIteration
. String.match
andString.replace
now resetRegExp.lastIndex
(bug 501739).
See also:
Firefox 26
EcmaScript 6 (Harmony) implementation continues!
- The ECMAScript 6 compliant syntax for Generators (yield) has been implemented (bug 666399).
- Generator/Iterator results are now boxed like
{ value: foo, done: bool }
(bug 907744). - New mathematical methods have been implemented on
Math
:Math.fround()
(bug 900125). - The reserved words cannot be used for function names:such a usage now throws a
SyntaxError
(bug 907958). - The default parameter syntax has been updated to allow parameters without defaults after default parameters, such as
function f(x=1, y)
. See bug 777060. GeneratorFunction
is implemented (bug 904701).
See also:
Firefox 25
EcmaScript 6 (Harmony) implementation continues!
- The method
Array.of()
is now implemented onArray
(bug 866849). - Support for the methods
Array.prototype.find()
andArray.prototype.findIndex()
has been added (bug 885553). - The methods
Number.parseInt()
andNumber.parseFloat()
have been implemented (bug 886949) - The methods
Map.prototype.forEach()
andSet.prototype.forEach()
are now implemented (bug 866847). - New mathematical methods have been implemented on
Math
:Math.log10()
,Math.log2()
,Math.log1p()
,Math.expm1()
,Math.cosh()
,Math.sinh()
,Math.tanh()
,Math.acosh()
,Math.asinh()
,Math.atanh()
,Math.trunc()
,Math.sign()
andMath.cbrt()
(bug 717379). - Support for binary and octal integer literals has been added:
0b10101010
,0B1010
,0o777
,0O237
are now valid (bug 894026). - The machine epsilon constant, that is the smallest representible number that added to 1 will not be 1, is now available as
Number.EPSILON
(bug 885798). - Typed arrays have been updated to no longer search in the prototype chain for indexed properties (bug 829896).
See also:
Firefox 24
- Arrow functions are no longer automatically in strict mode unless explicitly requested with
"use strict"
(bug 852762). - The
String.prototype.repeat
JS method has been implemented (bug 815431). - The
Set.prototype.values()
,Set.prototype.keys()
andSet.prototype.entries()
methods onSet
objects have been implemented (bug 869996).
See also:
Firefox 23
- The
Object.defineProperty
method can now be used to redefine thelength
property of anArray
object. - The option to disable JavaScript, including the options to allow moving windows/replace context menu, have been removed. You may still disable JavaScript by double clicking the "javascript.enabled" option in about:config.
See also:
Firefox 22
- Asm.js optimizations are enabled, making it possible to compile C/C++ applications to a subset of JavaScript for better performance.
- ES6 Arrow Function syntax has been implemented (bug 846406).
- The new Object.is function has been added (bug 839979).
arguments
in generator expressions is now inherited from enclosing lexical scope (bug 848051).- The ES6 Proxy
preventExtensions
trap have been implemented (bug 789897).
See also:
Firefox 21
- E4X, an ancient JavaScript extension, has been removed. Implemented only in Gecko, it never got significant traction (bug 788293).
- parseInt no longer treats strings with leading "0" as octal (bug 786135).
See also:
Firefox 20
- Support for the
Weakmap.prototype.clear()
method, recently added to the Harmony (EcmaScript 6) draft proposal has been added (bug 814562). - Support for the
Math.imul()
method, a C-style 32-bit multiplication function. Though proposed for Harmony (EcmaScript 6) it has not yet accepted and still is non-standard (bug 808148). - Web apps using draggable text with Kinetic 3.x are working, even when using the Cairo canvas backend (bug 835064).
- The
for each…in
statement has been deprecated and should not be used. Consider using the newfor…of
statement (bug 804834). - Support for the
Map.prototype.keys()
,Map.prototype.values()
, andMap.prototype.entries()
has been added (bug 817368).
See also:
Firefox 19
Map
andSet
objects have changed from having asize()
method to asize
property (bug 807001)Map
andSet
objects also have a clear() method now. (bug 805003)
See also:
Firefox 18
- Harmony's (ECMAScript 6) Direct Proxies have been landed (bug 703537). Warning: the implementation contains a couple of known bugs, missing features and misalignements with the current state of the spec. Do not rely on it for production code.
- The ECMAScript 6
contains()
method is now implemented on strings. This is unfortunately not compatible with Mootools 1.2, which expects different behavior fromcontains()
on strings but does not ensure it. Newer versions of Mootools fix this issue; sites should upgrade their Mootools version to something newer than 1.2.
See also:
Firefox 17
String
object now offers HarmonystartsWith
,endsWith
, andcontains
methods (bug 772733).- The String methods link and anchor now escape the
'"'
(quotation mark) (bug 352437). - Experimental support for strawman
ParallelArray
object has been implemented (bug 778559). - Support to iterate
Map
/Set
(bug 725909). - Disabled E4X for web content by default (bug 778851).
__exposedProps__
must now be set for Chrome JavaScript objects exposed to content. Attempts to access Chrome objects from content without__exposedProps__
set will fail silently (bug 553102).for..of
loops now work in terms of.iterator()
and.next()
(bug 725907).
See also:
Firefox 16
Number
objects now offerisFinite()
,toInteger()
, andisInteger()
methods. (bug 761480, bug 761495)- The Harmony spread operator is now supported in
Array
initializers (bug 574130). Note it is not yet supported in calls (bug 762363). - The experimental
TypedArray.prototype.move()
method has been added (available in Aurora and Nightly channels only) (bug 730873).
See also:
Firefox 15
- Support for the
DataView
interface from the Typed Arrays specification has been added. This provides low-level access to the data contained in anArrayBuffer
. - Support for new ECMAScript 6 built-ins:
Number.isNaN()
,Number.toInteger()
,Number.isInteger()
,Number.isFinite()
has been added. (bug 749818, bug 761495, bug 761480). - Support for ECMAScript 6 default parameters has been added. (bug 757676).
- Support for ECMAScript 6 rest parameters has been added. (bug 574132).
See also:
Firefox 14
No change.
See also:
Firefox 13
See also:
Firefox 12
- Support for sharp variables (a Netscape non-standard extension) has been dropped.
ArrayBuffer.prototype.slice()
has been implemented.
See also:
Firefox 11
No change.
See also:
Firefox 10
- The method
WeakMap.set()
now returnsundefined
, instead of itself. - A bug was introduced in regular expression handling in Firefox 7; this has been fixed. See bug 683838 if you want the gory details.
- You can no longer use E4X syntax while in ECMAScript 5 strict mode (that is, after
"use strict;"
).
See also:
Firefox 9
No change.
See also:
Firefox 8
RegExp.exec()
andRegExp.test()
called with no arguments now match against the string "undefined".String.search()
andString.match()
called with no arguments orundefined
now match against the empty string and thus match every string.- Support for watchlists has been implemented with the new (non-standard)
watch()
andunwatch()
methods.
See also:
Firefox 7
- The
Function.arity
property has been removed; useFunction.length
instead.
See also:
Firefox 6
- In the past, it was possible to use the
new
operator on several built-in functions (eval, parseInt, Date.parse...) that should not have allowed it, according to the specification. This behavior is no longer supported. Using thenew
operator in this way was never officially supported and was not widely done, so it's unlikely that this change affects you. - ECMAScript Harmony WeakMaps have been added as a prototype implementation.
See also:
Firefox 5
- Regular expressions are no longer callable as if they were functions; this change has been made in concert with the WebKit team to ensure compatibility (see WebKit bug 28285. This feature had existed for a long time but was never documented (at least, not here on MDC).
- The
Function.prototype.isGenerator()
method is now supported; this lets you determine if a function is a generator. - The following reserved words were previously only treated as reserved when in strict mode; now they're always treated as reserved:
class
,enum
,export
,extends
,import
, andsuper
. - DOM documents created in chrome code may no longer be exposed to sandboxed scripts.
- The JSON parser has been re-written for improved speed and compliance. This includes a fix for bug 572279.
See also:
Older versions
For versions prior to Firefox 5, see the old JavaScript versions.