archives

« Bugzilla Issues Index

#3208 — String.prototype.substr/slice language mistreats -0 as start


Minor language nitpick in step 8:

8. If intStart is negative, then let intStart be max(size + intStart,0).

where |intStart| is |ToInteger(start)|, that being the zeroth argument passed to the method. Thus it's possible to get -0 here, so "negative" isn't the right description to use. "less than zero" would seem to do the trick.

(ES5 had "If Result(2) is positive or zero, use Result(2); else use max(Result(4)+Result(2),0)." so you definitely don't want -0 => size, but rather -0 => 0.)


Same issue with String.prototype.slice, except there wrt both start *and* end arguments.


fixed in rev28 editor's draft

also fixed a number of additional occurrences


fixed in rev28