Skip to content

Commit 908e097

Browse files
committed
fix: sort ie browsers
1 parent d857527 commit 908e097

2 files changed

Lines changed: 27 additions & 27 deletions

File tree

index.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,55 @@
44

55
/** @type {UserAgentRegex[]} */
66
export const regexes = [
7+
{
8+
regex: /IE (\d+)\.(\d+)/,
9+
family: 'ie',
10+
maxVersion: [
11+
7,
12+
Infinity,
13+
Infinity
14+
]
15+
},
716
/**
817
* IE can be in Compatability Mode (IE 7.0)
918
* so we need to check Trident version
1019
*/
1120
{
12-
regex: /Trident\/[78]\.0/,
21+
regex: /Trident\/4\.0/,
1322
family: 'ie',
1423
version: [
15-
11,
24+
8,
1625
0,
1726
0
1827
]
1928
},
2029
{
21-
regex: /Trident\/6\.0/,
30+
regex: /Trident\/5\.0/,
2231
family: 'ie',
2332
version: [
24-
10,
33+
9,
2534
0,
2635
0
2736
]
2837
},
2938
{
30-
regex: /Trident\/5\.0/,
39+
regex: /Trident\/6\.0/,
3140
family: 'ie',
3241
version: [
33-
9,
42+
10,
3443
0,
3544
0
3645
]
3746
},
3847
{
39-
regex: /Trident\/4\.0/,
48+
regex: /Trident\/[78]\.0/,
4049
family: 'ie',
4150
version: [
42-
8,
51+
11,
4352
0,
4453
0
4554
]
4655
},
47-
{
48-
regex: /IE (\d+)\.(\d+)/,
49-
family: 'ie',
50-
maxVersion: [
51-
7,
52-
Infinity,
53-
Infinity
54-
]
55-
},
5656
{
5757
regex: /Edge?\/(\d+)(\.(\d+)|)(\.(\d+)|)/,
5858
family: 'edge'

test/useragents.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,46 @@ export const useragents = [
2222
*/
2323
{
2424
ua: 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)',
25-
regex: ['ie@8.0.0', 'ie@<=7']
25+
regex: ['ie@<=7', 'ie@8.0.0']
2626
},
2727
/**
2828
* IE 8 Compatability Mode
2929
*/
3030
{
3131
ua: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)',
32-
regex: ['ie@8.0.0', 'ie@<=7']
32+
regex: ['ie@<=7', 'ie@8.0.0']
3333
},
3434
/**
3535
* IE 9
3636
*/
3737
{
3838
ua: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',
39-
regex: ['ie@9.0.0', 'ie@<=7']
39+
regex: ['ie@<=7', 'ie@9.0.0']
4040
},
4141
/**
4242
* IE 9 Compatability Mode
4343
*/
4444
{
4545
ua: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)',
46-
regex: ['ie@9.0.0', 'ie@<=7']
46+
regex: ['ie@<=7', 'ie@9.0.0']
4747
},
4848
/**
4949
* IE 10
5050
*/
5151
{
5252
ua: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
53-
regex: ['ie@10.0.0', 'ie@<=7']
53+
regex: ['ie@<=7', 'ie@10.0.0']
5454
},
5555
{
5656
ua: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)',
57-
regex: ['ie@10.0.0', 'ie@<=7']
57+
regex: ['ie@<=7', 'ie@10.0.0']
5858
},
5959
/**
6060
* IE 10 Compatability Mode
6161
*/
6262
{
6363
ua: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)',
64-
regex: ['ie@10.0.0', 'ie@<=7']
64+
regex: ['ie@<=7', 'ie@10.0.0']
6565
},
6666
/**
6767
* IE 11
@@ -75,7 +75,7 @@ export const useragents = [
7575
*/
7676
{
7777
ua: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)',
78-
regex: ['ie@11.0.0', 'ie@<=7']
78+
regex: ['ie@<=7', 'ie@11.0.0']
7979
},
8080
/**
8181
* Edge on EdgeHTML
@@ -335,16 +335,16 @@ export const useragents = [
335335
{
336336
ua: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)',
337337
regex: [
338-
'ie@9.0.0',
339338
'ie@<=7',
339+
'ie@9.0.0',
340340
'ie_mob'
341341
]
342342
},
343343
{
344344
ua: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)',
345345
regex: [
346-
'ie@10.0.0',
347346
'ie@<=7',
347+
'ie@10.0.0',
348348
'ie_mob'
349349
]
350350
},

0 commit comments

Comments
 (0)