MCPcopy
hub / github.com/tdewolff/minify / detect

Function detect

_benchmarks/sample_echarts.js:119–156  ·  view source on GitHub ↗
(ua, env)

Source from the content-addressed store, hash-verified

117 detect(navigator.userAgent, env);
118 }
119 function detect(ua, env) {
120 var browser = env.browser;
121 var firefox = ua.match(/Firefox\/([\d.]+)/);
122 var ie = ua.match(/MSIE\s([\d.]+)/)
123 || ua.match(/Trident\/.+?rv:(([\d.]+))/);
124 var edge = ua.match(/Edge?\/([\d.]+)/);
125 var weChat = (/micromessenger/i).test(ua);
126 if (firefox) {
127 browser.firefox = true;
128 browser.version = firefox[1];
129 }
130 if (ie) {
131 browser.ie = true;
132 browser.version = ie[1];
133 }
134 if (edge) {
135 browser.edge = true;
136 browser.version = edge[1];
137 browser.newEdge = +edge[1].split('.')[0] > 18;
138 }
139 if (weChat) {
140 browser.weChat = true;
141 }
142 env.canvasSupported = !!document.createElement('canvas').getContext;
143 env.svgSupported = typeof SVGRect !== 'undefined';
144 env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;
145 env.pointerEventsSupported = 'onpointerdown' in window
146 && (browser.edge || (browser.ie && +browser.version >= 11));
147 env.domSupported = typeof document !== 'undefined';
148 var style = document.documentElement.style;
149 env.transform3dSupported = ((browser.ie && 'transition' in style)
150 || browser.edge
151 || (('WebKitCSSMatrix' in window) && ('m11' in new WebKitCSSMatrix()))
152 || 'MozPerspective' in style)
153 && !('OTransition' in style);
154 env.transformSupported = env.transform3dSupported
155 || (browser.ie && +browser.version >= 9);
156 }
157
158 var BUILTIN_OBJECT = {
159 '[object Function]': true,

Callers 1

sample_echarts.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…