]> git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/docs/assets/js/ie-emulation-modes-warning.js
Introduce autotools
[ipfire.org.git] / src / scss / bootstrap-4.0.0-alpha.6 / docs / assets / js / ie-emulation-modes-warning.js
1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
4 /*!
5 * Copyright 2014-2015 The Bootstrap Authors
6 * Copyright 2014-2015 Twitter, Inc.
7 *
8 * Licensed under the Creative Commons Attribution 3.0 Unported License. For
9 * details, see https://creativecommons.org/licenses/by/3.0/.
10 */
11 // 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.
12 (function () {
13 'use strict'
14
15 function emulatedIEMajorVersion() {
16 var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
17 if (groups === null) {
18 return null
19 }
20 var ieVersionNum = parseInt(groups[1], 10)
21 var ieMajorVersion = Math.floor(ieVersionNum)
22 return ieMajorVersion
23 }
24
25 function actualNonEmulatedIEMajorVersion() {
26 // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
27 // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
28 // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
29 var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')()
30 if (jscriptVersion === undefined) {
31 return 11 // IE11+ not in emulation mode
32 }
33 if (jscriptVersion < 9) {
34 return 8 // IE8 (or lower; haven't tested on IE<8)
35 }
36 return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
37 }
38
39 var ua = window.navigator.userAgent
40 if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
41 return // Opera, which might pretend to be IE
42 }
43 var emulated = emulatedIEMajorVersion()
44 if (emulated === null) {
45 return // Not IE
46 }
47 var nonEmulated = actualNonEmulatedIEMajorVersion()
48
49 if (emulated !== nonEmulated) {
50 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!')
51 }
52 }())