Skip to content

Commit 0a056bc

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents a7d6e1a + d7acfc0 commit 0a056bc

File tree

3 files changed

+5033
-13
lines changed

3 files changed

+5033
-13
lines changed

lib/create-sort.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const maxHeight = /\(\s*max(-device)?-height|\(\s*height\s*<(=)?/i;
2222
const isMinHeight = _testQuery(minMaxHeight, maxMinHeight, minHeight);
2323
const isMaxHeight = _testQuery(maxMinHeight, minMaxHeight, maxHeight);
2424

25+
const lessThan = /<(?!=)/;
26+
const grtrThan = />(?!=)/;
27+
2528
const isPrint = /print/i;
2629
const isPrintOnly = /^print$/i;
2730

@@ -202,6 +205,25 @@ module.exports = function createSort(configuration) {
202205
return -1;
203206
}
204207

208+
if (lengthA === lengthB) {
209+
if (maxA && maxB) {
210+
if (lessThan.test(a) && !lessThan.test(b)) {
211+
return 1;
212+
}
213+
if (!lessThan.test(a) && lessThan.test(b)) {
214+
return -1;
215+
}
216+
}
217+
if (minA && minB) {
218+
if (grtrThan.test(a) && !grtrThan.test(b)) {
219+
return 1;
220+
}
221+
if (!grtrThan.test(a) && grtrThan.test(b)) {
222+
return -1;
223+
}
224+
}
225+
}
226+
205227
return a.localeCompare(b);
206228
}
207229
}
@@ -263,6 +285,25 @@ module.exports = function createSort(configuration) {
263285
return -1;
264286
}
265287

288+
if (lengthA === lengthB) {
289+
if (maxA && maxB) {
290+
if (lessThan.test(a) && !lessThan.test(b)) {
291+
return 1;
292+
}
293+
if (!lessThan.test(a) && lessThan.test(b)) {
294+
return -1;
295+
}
296+
}
297+
if (minA && minB) {
298+
if (grtrThan.test(a) && !grtrThan.test(b)) {
299+
return 1;
300+
}
301+
if (!grtrThan.test(a) && grtrThan.test(b)) {
302+
return -1;
303+
}
304+
}
305+
}
306+
266307
return -a.localeCompare(b);
267308
}
268309
};

0 commit comments

Comments
 (0)