Switched sort function from boolean to explicit -1 and 1 thus avoiding failures to sort when false is evaluated as 0

pull/504/head
James Robinson 6 years ago committed by Gijs
parent 44e90de00b
commit ee18c21fc2

@ -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

Loading…
Cancel
Save