File indexing completed on 2024-05-12 17:26:18

0001 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
0002 // IT'S JUST JUNK FOR OUR DOCS!
0003 // ++++++++++++++++++++++++++++++++++++++++++
0004 /*!
0005  * Copyright 2014 Twitter, Inc.
0006  *
0007  * Licensed under the Creative Commons Attribution 3.0 Unported License. For
0008  * details, see http://creativecommons.org/licenses/by/3.0/.
0009  */
0010 // 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.
0011 (function () {
0012   'use strict';
0013 
0014   function emulatedIEMajorVersion() {
0015     var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
0016     if (groups === null) {
0017       return null
0018     }
0019     var ieVersionNum = parseInt(groups[1], 10)
0020     var ieMajorVersion = Math.floor(ieVersionNum)
0021     return ieMajorVersion
0022   }
0023 
0024   function actualNonEmulatedIEMajorVersion() {
0025     // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
0026     // IE JavaScript conditional compilation docs: http://msdn.microsoft.com/en-us/library/ie/121hztk3(v=vs.94).aspx
0027     // @cc_on docs: http://msdn.microsoft.com/en-us/library/ie/8ka90k2e(v=vs.94).aspx
0028     var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // jshint ignore:line
0029     if (jscriptVersion === undefined) {
0030       return 11 // IE11+ not in emulation mode
0031     }
0032     if (jscriptVersion < 9) {
0033       return 8 // IE8 (or lower; haven't tested on IE<8)
0034     }
0035     return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
0036   }
0037 
0038   var ua = window.navigator.userAgent
0039   if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
0040     return // Opera, which might pretend to be IE
0041   }
0042   var emulated = emulatedIEMajorVersion()
0043   if (emulated === null) {
0044     return // Not IE
0045   }
0046   var nonEmulated = actualNonEmulatedIEMajorVersion()
0047 
0048   if (emulated !== nonEmulated) {
0049     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!')
0050   }
0051 })();