archives

« Bugzilla Issues Index

#332 — 15.4.4.12 Array splice does not set result length correctly if trailing deleted elements are holes


Between lines 9.d and 10 and new top level line needs to be inserted:

10.0 Call the [[Put]] internal method of A with arguments "length", actualDeleteCount, and true.

The ES3 spec. has the equivalent of the above line. It was apparently inadvertently dropped in the ES5 spec.

Test case from John-David Dalton:

/ sparse array ;D
var a=[0];
a[2]=2;

// the resulting arrays length should be 2 and not 1
console.log(a.splice(0, 2).length);

ES3 spec would yield 2 for the above case. ES5/5/1 yields 1. That change was unintentional

Marked as "in progress" to flag as for errata


Bulk resolving ES5.1 errata issues as a sampling suggests these are all fixed. If this is in error, please open a new issue on GitHub.