Files
ask262/spec-built/multipage/corrections-and-clarifications-in-ecmascript-2015-with-possible-compatibility-impact.html

18 lines
8.0 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en-GB-oxendict"><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><meta property="og:image" content="https://tc39.es/ecmarkup/ecma-logo.png"><meta property="og:title" content="ECMAScript® 2026 Language&nbsp;Specification"><meta property="og:description" content="Introduction
This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invent">
<link rel="icon" href="../img/favicon.ico">
<link rel="stylesheet" href="../assets/css/ecmarkup.css"><link rel="stylesheet" href="../assets/css/print.css" media="print">
<title>ECMAScript® 2026 Language&nbsp;Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script><link rel="canonical" href="../#sec-corrections-and-clarifications-in-ecmascript-2015-with-possible-compatibility-impact"></head>
<body><div id="spec-container"><emu-annex id="sec-corrections-and-clarifications-in-ecmascript-2015-with-possible-compatibility-impact">
<h1><span class="secnum">Annex E <span class="annex-kind">(informative)</span></span> Corrections and Clarifications in ECMAScript 2015 with Possible Compatibility Impact</h1>
<p><emu-xref href="#sec-candeclareglobalvar" id="_ref_936"><a href="executable-code-and-execution-contexts.html#sec-candeclareglobalvar">9.1.1.4.14</a></emu-xref>-<emu-xref href="#sec-createglobalfunctionbinding" id="_ref_937"><a href="executable-code-and-execution-contexts.html#sec-createglobalfunctionbinding">9.1.1.4.17</a></emu-xref> Edition 5 and 5.1 used a property existence test to determine whether a <emu-xref href="#sec-global-object" id="_ref_17306"><a href="global-object.html#sec-global-object">global object</a></emu-xref> property corresponding to a new global declaration already existed. ECMAScript 2015 uses an own property existence test. This corresponds to what has been most commonly implemented by web browsers.</p>
<p><emu-xref href="#sec-array-exotic-objects-defineownproperty-p-desc" id="_ref_938"><a href="ordinary-and-exotic-objects-behaviours.html#sec-array-exotic-objects-defineownproperty-p-desc">10.4.2.1</a></emu-xref>: The 5<sup>th</sup> Edition moved the capture of the current array length prior to the <emu-xref href="#integer" id="_ref_17307"><a href="notational-conventions.html#integer">integer</a></emu-xref> conversion of the <emu-xref href="#array-index" id="_ref_17308"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> or new length value. However, the captured length value could become invalid if the conversion process has the side-effect of changing the array length. ECMAScript 2015 specifies that the current array length must be captured after the possible occurrence of such side-effects.</p>
<p><emu-xref href="#sec-timeclip" id="_ref_939"><a href="numbers-and-dates.html#sec-timeclip">21.4.1.31</a></emu-xref>: Previous editions permitted the <emu-xref aoid="TimeClip" id="_ref_17309"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref> abstract operation to return either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub> as the representation of a 0 <emu-xref href="#sec-time-values-and-time-range" id="_ref_17310"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>. ECMAScript 2015 specifies that <emu-val>+0</emu-val><sub>𝔽</sub> always returned. This means that for ECMAScript 2015 the <emu-xref href="#sec-time-values-and-time-range" id="_ref_17311"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> of a Date is never observably <emu-val>-0</emu-val><sub>𝔽</sub> and methods that return <emu-xref href="#sec-time-values-and-time-range" id="_ref_17312"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time values</a></emu-xref> never return <emu-val>-0</emu-val><sub>𝔽</sub>.</p>
<p><emu-xref href="#sec-date-time-string-format" id="_ref_940"><a href="numbers-and-dates.html#sec-date-time-string-format">21.4.1.32</a></emu-xref>: If a UTC offset representation is not present, the local time zone is used. Edition 5.1 incorrectly stated that a missing time zone should be interpreted as <emu-val>"z"</emu-val>.</p>
<p><emu-xref href="#sec-date.prototype.toisostring" id="_ref_941"><a href="numbers-and-dates.html#sec-date.prototype.toisostring">21.4.4.36</a></emu-xref>: If the year cannot be represented using the Date Time String Format specified in <emu-xref href="#sec-date-time-string-format" id="_ref_942"><a href="numbers-and-dates.html#sec-date-time-string-format">21.4.1.32</a></emu-xref> a RangeError exception is thrown. Previous editions did not specify the behaviour for that case.</p>
<p><emu-xref href="#sec-date.prototype.tostring" id="_ref_943"><a href="numbers-and-dates.html#sec-date.prototype.tostring">21.4.4.41</a></emu-xref>: Previous editions did not specify the value returned by <code>Date.prototype.toString</code> when the <emu-xref href="#sec-time-values-and-time-range" id="_ref_17313"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> is <emu-val>NaN</emu-val>. ECMAScript 2015 specifies the result to be the String value <emu-val>"Invalid Date"</emu-val>.</p>
<p><emu-xref href="#sec-regexp-pattern-flags" id="_ref_944"><a href="text-processing.html#sec-regexp-pattern-flags">22.2.4.1</a></emu-xref>, <emu-xref href="#sec-escaperegexppattern" id="_ref_945"><a href="text-processing.html#sec-escaperegexppattern">22.2.6.13.1</a></emu-xref>: Any LineTerminator code points in the value of the <emu-val>"source"</emu-val> property of a RegExp instance must be expressed using an escape sequence. Edition 5.1 only required the escaping of <code>/</code>.</p>
<p><emu-xref href="#sec-regexp.prototype-%symbol.match%" id="_ref_946"><a href="text-processing.html#sec-regexp.prototype-%symbol.match%">22.2.6.8</a></emu-xref>, <emu-xref href="#sec-regexp.prototype-%symbol.replace%" id="_ref_947"><a href="text-processing.html#sec-regexp.prototype-%symbol.replace%">22.2.6.11</a></emu-xref>: In previous editions, the specifications for <code>String.prototype.match</code> and <code>String.prototype.replace</code> was incorrect for cases where the pattern argument was a RegExp value whose <code>global</code> flag is set. The previous specifications stated that for each attempt to match the pattern, if <code>lastIndex</code> did not change, it should be incremented by 1. The correct behaviour is that <code>lastIndex</code> should be incremented by 1 only if the pattern matched the empty String.</p>
<p><emu-xref href="#sec-array.prototype.sort" id="_ref_948"><a href="indexed-collections.html#sec-array.prototype.sort">23.1.3.30</a></emu-xref>: Previous editions did not specify how a <emu-val>NaN</emu-val> value returned by a <var>comparator</var> was interpreted by <code>Array.prototype.sort</code>. ECMAScript 2015 specifies that such as value is treated as if <emu-val>+0</emu-val><sub>𝔽</sub> was returned from the <var>comparator</var>. ECMAScript 2015 also specifies that <emu-xref aoid="ToNumber" id="_ref_17314"><a href="abstract-operations.html#sec-tonumber">ToNumber</a></emu-xref> is applied to the result returned by a <var>comparator</var>. In previous editions, the effect of a <var>comparator</var> result that <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_17315"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is not a Number</a></emu-xref> value was <emu-xref href="#implementation-defined" id="_ref_17316"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>. In practice, implementations call <emu-xref aoid="ToNumber" id="_ref_17317"><a href="abstract-operations.html#sec-tonumber">ToNumber</a></emu-xref>.</p>
</emu-annex></div></body></html>