[whatwg] Sortable Tables

Boris Zbarsky bzbarsky at MIT.EDU
Thu Dec 27 22:53:57 PST 2012


On 12/27/12 7:40 PM, Tab Atkins Jr. wrote:
> In JS, the comparator passed to sort() can potentially mutate the array
> that's being sorted, or delete it entirely. JS engines cope somehow.

Note that per spec the behavior if the comparator mutates the array is 
undefined.  Engines are allowed to go into infinite loops, crash, throw 
exceptions, whatever.  And sometimes do all of the above.

> since any problems you can possibly come up with are already present in the existing Array#sort
> function.

This part is true.

-Boris




More information about the whatwg mailing list