Skip to content

Commit 253a95b

Browse files
fixed wrong "ios" platform for IE 11 in "windowsmobile"
updated UA specs also
1 parent b1830c0 commit 253a95b

File tree

2 files changed

+52
-6
lines changed

2 files changed

+52
-6
lines changed

Source/Browser/Browser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var parse = function(ua, platform){
3737
UA[1] = 'chrome';
3838
}
3939

40-
platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || ua.match(/mac|win|linux/) || ['other'])[0];
40+
platform = ua.indexOf('windows phone') != -1 ? 'windowsmobile' : ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || ua.match(/mac|win|linux/) || ['other'])[0];
4141
if (platform == 'win') platform = 'windows';
4242

4343
return {

Specs/Browser/Browser.js

+51-5
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ describe('Browser.parseUA', function(){
165165
version: 11
166166
}
167167
},
168+
ie11mobile: {
169+
desc: 'Internet Explorer 11, Windows Phone',
170+
string: 'Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; SAMSUNG; GT-I8750) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537',
171+
expect: {
172+
name: 'ie',
173+
version: 11,
174+
platform: 'windowsmobile'
175+
}
176+
},
168177
ieCompat: {
169178
desc: 'Internet Explorer 10 in IE7 compatibility',
170179
string: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)',
@@ -173,12 +182,22 @@ describe('Browser.parseUA', function(){
173182
version: 7
174183
}
175184
},
176-
firefox: {
185+
firefox24: {
177186
desc: 'Firefox v24',
178187
string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Firefox/24.0',
179188
expect: {
180189
name: 'firefox',
181-
version: 24
190+
version: 24,
191+
platform: 'mac'
192+
}
193+
},
194+
firefox38: {
195+
desc: 'Firefox 38',
196+
string: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0',
197+
expect: {
198+
name: 'firefox',
199+
version: 38,
200+
platform: 'windows'
182201
}
183202
},
184203
opera10: {
@@ -205,22 +224,49 @@ describe('Browser.parseUA', function(){
205224
version: 12.14
206225
}
207226
},
208-
safari: {
227+
safari6: {
209228
desc: 'Safari 6.1',
210229
string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.71 (KHTML, like Gecko) Version/6.1 Safari/537.71',
211230
expect: {
212231
name: 'safari',
213-
version: 6.1
232+
version: 6.1,
233+
platform: 'mac'
214234
}
215235
},
216-
chrome: {
236+
safari7: {
237+
desc: 'Safari 7.0.3',
238+
string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A',
239+
expect: {
240+
name: 'safari',
241+
version: 7,
242+
platform: 'mac'
243+
}
244+
},
245+
safari8mobile: {
246+
desc: 'Safari 8 mobile',
247+
string: 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4',
248+
expect: {
249+
name: 'safari',
250+
version: 8,
251+
platform: 'ios'
252+
}
253+
},
254+
chrome31: {
217255
desc: 'Chrome 31',
218256
string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36',
219257
expect: {
220258
name: 'chrome',
221259
version: 31
222260
}
223261
},
262+
chrome44: {
263+
desc: 'Chrome 44',
264+
string: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36',
265+
expect: {
266+
name: 'chrome',
267+
version: 44
268+
}
269+
},
224270
chromeios: {
225271
desc: 'Chrome 33 on iOS',
226272
string: 'Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/33.0.1750.21 Mobile/11B554a Safari/9537.53',

0 commit comments

Comments
 (0)