Bug Tracker

Ticket #5380: selector.js.patch

File selector.js.patch, 684 bytes (added by antonkovalyov, 3 years ago)
  • src/selector.js

     
    133133 
    134134Sizzle.uniqueSort = function(results){ 
    135135        if ( sortOrder ) { 
    136                 hasDuplicate = false; 
     136                /* Here we check if the JavaScript engine is using some sort of 
     137                 * optimization where it does not always call our comparision 
     138                 * function. If that is the case, discard the hasDuplicate value. */ 
     139                hasDuplicate = true; 
     140                ['', ''].sort(function(a,b) { hasDuplicate = false; return 0; }); 
    137141                results.sort(sortOrder); 
    138142 
    139143                if ( hasDuplicate ) { 
     
    144148                        } 
    145149                } 
    146150        } 
    147  
    148151        return results; 
    149152}; 
    150153