Permalink
Browse files

Call the sort function for loops with the context as the scope. eg: t…

…o get some sort keys
  • Loading branch information...
1 parent 5e09071 commit 247c79f5f5e654a1f6e89466cbfbeb7526b83b04 @pure committed Dec 2, 2012
Showing with 25 additions and 21 deletions.
  1. +4 −2 libs/pure.js
  2. +21 −19 libs/pure_min.js
View
@@ -7,7 +7,7 @@
Copyright (c) 2012 Michael Cvilic - BeeBole.com
Thanks to Rog Peppe for the functional JS jump
- revision: 2.79
+ revision: 2.80
*/
var $p = function(){
@@ -403,7 +403,9 @@ $p.core = function(sel, ctxt, plugins){
length = a.length || 0;
// if sort directive
if(typeof sorter === 'function'){
- a.sort(sorter);
+ a.sort(function(a, b){
+ return sorter.call(ctxt, a, b);
+ });
}
//loop on array
for(i = 0, ii = length; i < ii; i++){
Oops, something went wrong.

0 comments on commit 247c79f

Please sign in to comment.