Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

48 lignes
2.0KB

  1. // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
  2. // IT'S ALL JUST JUNK FOR OUR DOCS!
  3. // ++++++++++++++++++++++++++++++++++++++++++
  4. // 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.
  5. (function () {
  6. 'use strict'
  7. function emulatedIEMajorVersion() {
  8. var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
  9. if (groups === null) {
  10. return null
  11. }
  12. var ieVersionNum = parseInt(groups[1], 10)
  13. var ieMajorVersion = Math.floor(ieVersionNum)
  14. return ieMajorVersion
  15. }
  16. function actualNonEmulatedIEMajorVersion() {
  17. // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
  18. // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
  19. // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
  20. var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // eslint-disable-line no-new-func
  21. if (typeof jscriptVersion === 'undefined') {
  22. return 11 // IE11+ not in emulation mode
  23. }
  24. if (jscriptVersion < 9) {
  25. return 8 // IE8 (or lower; haven't tested on IE<8)
  26. }
  27. return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
  28. }
  29. var ua = window.navigator.userAgent
  30. if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
  31. return // Opera, which might pretend to be IE
  32. }
  33. var emulated = emulatedIEMajorVersion()
  34. if (emulated === null) {
  35. return // Not IE
  36. }
  37. var nonEmulated = actualNonEmulatedIEMajorVersion()
  38. if (emulated !== nonEmulated) {
  39. // eslint-disable-next-line no-alert
  40. 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!')
  41. }
  42. }())