MCPcopy
hub / github.com/Voog/wysihtml / isIE

Function isIE

src/browser.js:22–47  ·  view source on GitHub ↗
(version, equation)

Source from the content-addressed store, hash-verified

20 }
21
22 function isIE(version, equation) {
23 var rv = -1,
24 re;
25
26 if (navigator.appName == 'Microsoft Internet Explorer') {
27 re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
28 } else if (navigator.appName == 'Netscape') {
29 if (navigator.userAgent.indexOf("Trident") > -1) {
30 re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
31 } else if ((/Edge\/(\d+)./i).test(navigator.userAgent)) {
32 re = /Edge\/(\d+)./i;
33 }
34 }
35
36 if (re && re.exec(navigator.userAgent) != null) {
37 rv = parseFloat(RegExp.$1);
38 }
39
40 if (rv === -1) { return false; }
41 if (!version) { return true; }
42 if (!equation) { return version === rv; }
43 if (equation === "<") { return version < rv; }
44 if (equation === ">") { return version > rv; }
45 if (equation === "<=") { return version <= rv; }
46 if (equation === ">=") { return version >= rv; }
47 }
48
49 return {
50 // Static variable needed, publicly accessible, to be able override it in unit tests

Callers 1

browser.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected