- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 27 Dec 2012 19:40:17 -0800
- To: Ian Hickson <ian@hixie.ch>
- Cc: WHATWG List <whatwg@whatwg.org>
On Dec 27, 2012 6:04 PM, "Ian Hickson" <ian@hixie.ch> wrote: > > 2. What values should the sort property allow. One idea is that it takes > > a JS function similar to what JavaScript's sort function takes. If you > > leave it out then it just does alphanumeric sort. > > I was going to have a comparator function, but I couldn't see a sane way > to make it work in the face of hostile functions that mutate the DOM, so > I dropped it. You can do custom sort orders by giving a key in the <data> > element's value="" attribute, though. In JS, the comparator passed to sort() can potentially mutate the array that's being sorted, or delete it entirely. JS engines cope somehow. It's silly to not support a custom comparator here, since any problems you can possibly come up with are already present in the existing Array#sort function. ~TJ
Received on Friday, 28 December 2012 03:40:44 UTC