Skip to content

Commit

Permalink
Switched sort function from boolean to explicit -1 and 1 thus avoidin…
Browse files Browse the repository at this point in the history
…g failures to sort when false is evaluated as 0
  • Loading branch information
jemrobinson authored and gijsk committed Nov 20, 2018
1 parent 44e90de commit ee18c21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Readability.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ Readability.prototype = {
this._attempts.push({articleContent: articleContent, textLength: textLength});
// No luck after removing flags, just return the longest text we found during the different loops
this._attempts.sort(function (a, b) {
return a.textLength < b.textLength;
return (a.textLength < b.textLength) ? 1 : -1;
});

// But first check if we actually have something
Expand Down

0 comments on commit ee18c21

Please sign in to comment.