1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-19 03:41:19 +02:00

Add back support for IE 11

This commit is contained in:
Johann-S
2019-03-16 16:10:23 +02:00
committed by XhmikosR
parent f7c1b1e683
commit 08679ac0b5
10 changed files with 214 additions and 106 deletions

View File

@@ -731,7 +731,14 @@ $(function () {
})
QUnit.test('should enforce focus', function (assert) {
assert.expect(2)
var isIE11 = Boolean(window.MSInputMethodContext) && Boolean(document.documentMode)
if (isIE11) {
assert.expect(1)
} else {
assert.expect(2)
}
var done = assert.async()
var $modal = $([
@@ -759,14 +766,18 @@ $(function () {
done()
}
document.addEventListener('focusin', focusInListener)
if (isIE11) {
done()
} else {
document.addEventListener('focusin', focusInListener)
var focusInEvent = new Event('focusin')
Object.defineProperty(focusInEvent, 'target', {
value: $('#qunit-fixture')[0]
})
var focusInEvent = new Event('focusin')
Object.defineProperty(focusInEvent, 'target', {
value: $('#qunit-fixture')[0]
})
document.dispatchEvent(focusInEvent)
document.dispatchEvent(focusInEvent)
}
})
.bootstrapModal('show')
})

View File

@@ -0,0 +1,28 @@
// Polyfills for our unit tests
(function () {
'use strict'
// Event constructor shim
if (!window.Event || typeof window.Event !== 'function') {
var origEvent = window.Event
window.Event = function (inType, params) {
params = params || {}
var e = document.createEvent('Event')
e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable))
return e
}
window.Event.prototype = origEvent.prototype
}
if (typeof window.CustomEvent !== 'function') {
window.CustomEvent = function (event, params) {
params = params || { bubbles: false, cancelable: false, detail: null }
var evt = document.createEvent('CustomEvent')
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)
return evt
}
CustomEvent.prototype = window.Event.prototype
}
})()