scottjehl/picturefill — pull request #183 by gBokiau (2014-04-16 07:38:09+00:00)
Title: fix candidate selection

previous ascendingSort() wasn’t doing much, since not returning -1 when
resolution ‘a’ was smaller than that of ‘b’. I fixed this ( - instead
of >) but also resorted to ascending sorting.

The logic now goes that we start with the highest resolution available,
then go down gradually until we find the last one that is above the
Dpr. This solves the situation where all available images are below Dpr
(previously the lowest candidate would have been served, now the
highest is being served)