Improve isIE check to allow us to check for a minimum version

This commit is contained in:
Colin O'Byrne and JR Boyens
2013-07-22 14:22:14 -07:00
parent 2165d71dc5
commit f2306729cd
3 changed files with 11 additions and 9 deletions

View File

@@ -1,8 +1,10 @@
function isIE(version) {
var userAgent = jasmine.getGlobal().navigator.userAgent;
if (!userAgent) { return; }
(function(global) {
global.ieVersion = (function() {
var userAgent = jasmine.getGlobal().navigator.userAgent;
if (!userAgent) { return Number.MAX_VALUE; }
var match = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(userAgent);
var match = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(userAgent);
return match && version ? parseFloat(match[1]) === version : match;
}
return match ? parseFloat(match[1]) : Number.MAX_VALUE;
})();
})(jasmine.getGlobal());