ECMAScript proposal at stage 3 of the process, see https://github.com/tc39/proposals
This is a specification draft for the legacy (deprecated) RegExp features in JavaScript, i.e., static properties of the constructor like RegExp.$1 as well as the RegExp.prototype.compile method.
This does not reflect what the implementations do, but what the editor thinks to be the least bad thing they ought to do in order to maintain web compatibility.
RegExp static properties (currently not part of ECMA 262,see tc39/ecma262#137) are specified such that:
The proposal includes another feature that needs consensus and implementation experience before being specced:
We have attempted to identify potential risks induced by the the backward-compatibility break introduced by that feature.
See also the differences between this spec and the current implementations.
The amendments are relative to the last ECMAScript specification draft found at: https://tc39.github.io/ecma262/ Changes relative to existing algorithms are marked in bold.
All the amendments are part of Annex B, including those that modify objects or algorithm defined in other parts of the spec.
The %RegExp% intrinsic object, which is the builtin RegExp constructor, has the following additional internal slots:
The initial value of all these internal slots is the empty String.
RegExp instances have an additional slot which optionally keeps a reference to its constructor. It is used for deciding whether a nonstandard legacy feature is enabled for that regexp. The RegExpAlloc abstract operation is modified as follows:
In the RegExpBuiltInExec abstract operation, a hook is added for updating the static properties of %RegExp% after a successful match. The last three steps of the algorithm are modified as follows:
The abstract operation UpdateLegacyRegExpStaticProperties updates the values of the static properties of %RegExp% after a successful match.
The abstract operation InvalidateLegacyRegExpStaticProperties marks the values of the static properties of %RegExp% as non-available.
All the below properties are accessor properties who have the attributes { [[Enumerable]]: false, [[Configurable]]: true }. Moreover, for the properties whose setter is not explicitely defined, the [[Set]] attribute is set to undefined.
The accessors check for their this value, so that the properties do not appear to be inherited by subclasses.
The abstract operation GetLegacyRegExpStaticProperty is used when retrieving a value from a legacy RegExp static property.
The abstract operation SetLegacyRegExpStaticProperty is used when assigning a value to a legacy RegExp static property.
The modification below will disable RegExp.prototype.compile for objects that are not direct instances of RegExp as well as in case of mismatch between realms.
ECMAScript proposal at stage 3 of the process, see https://github.com/tc39/proposals
This is a specification draft for the legacy (deprecated) RegExp features in JavaScript, i.e., static properties of the constructor like RegExp.$1 as well as the RegExp.prototype.compile method.
This does not reflect what the implementations do, but what the editor thinks to be the least bad thing they ought to do in order to maintain web compatibility.
RegExp static properties (currently not part of ECMA 262,see tc39/ecma262#137) are specified such that:
The proposal includes another feature that needs consensus and implementation experience before being specced:
We have attempted to identify potential risks induced by the the backward-compatibility break introduced by that feature.
See also the differences between this spec and the current implementations.
The amendments are relative to the last ECMAScript specification draft found at: https://tc39.github.io/ecma262/ Changes relative to existing algorithms are marked in bold.
All the amendments are part of Annex B, including those that modify objects or algorithm defined in other parts of the spec.
The %RegExp% intrinsic object, which is the builtin RegExp constructor, has the following additional internal slots:
The initial value of all these internal slots is the empty String.
RegExp instances have an additional slot which optionally keeps a reference to its constructor. It is used for deciding whether a nonstandard legacy feature is enabled for that regexp. The RegExpAlloc abstract operation is modified as follows:
In the RegExpBuiltInExec abstract operation, a hook is added for updating the static properties of %RegExp% after a successful match. The last three steps of the algorithm are modified as follows:
The abstract operation UpdateLegacyRegExpStaticProperties updates the values of the static properties of %RegExp% after a successful match.
The abstract operation InvalidateLegacyRegExpStaticProperties marks the values of the static properties of %RegExp% as non-available.
All the below properties are accessor properties who have the attributes { [[Enumerable]]: false, [[Configurable]]: true }. Moreover, for the properties whose setter is not explicitely defined, the [[Set]] attribute is set to undefined.
The accessors check for their this value, so that the properties do not appear to be inherited by subclasses.
The abstract operation GetLegacyRegExpStaticProperty is used when retrieving a value from a legacy RegExp static property.
The abstract operation SetLegacyRegExpStaticProperty is used when assigning a value to a legacy RegExp static property.
The modification below will disable RegExp.prototype.compile for objects that are not direct instances of RegExp as well as in case of mismatch between realms.