ca2ae1222bb1c4f81de009fe614e36212d4fad1a
[vnfsdk/refrepo.git] /
1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
4
5 // Intended to prevent false-positive bug reports about Bootstrap not working properly in old versions of IE due to folks testing using IE's unreliable emulation modes.
6 (function () {
7   'use strict'
8
9   function emulatedIEMajorVersion() {
10     var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
11     if (groups === null) {
12       return null
13     }
14     var ieVersionNum = parseInt(groups[1], 10)
15     var ieMajorVersion = Math.floor(ieVersionNum)
16     return ieMajorVersion
17   }
18
19   function actualNonEmulatedIEMajorVersion() {
20     // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
21     // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
22     // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
23     var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // eslint-disable-line no-new-func
24     if (typeof jscriptVersion === 'undefined') {
25       return 11 // IE11+ not in emulation mode
26     }
27     if (jscriptVersion < 9) {
28       return 8 // IE8 (or lower; haven't tested on IE<8)
29     }
30     return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
31   }
32
33   var ua = window.navigator.userAgent
34   if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
35     return // Opera, which might pretend to be IE
36   }
37   var emulated = emulatedIEMajorVersion()
38   if (emulated === null) {
39     return // Not IE
40   }
41   var nonEmulated = actualNonEmulatedIEMajorVersion()
42
43   if (emulated !== nonEmulated) {
44     // eslint-disable-next-line no-alert
45     window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
46   }
47 }())