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:
@@ -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')
|
||||
})
|
||||
|
28
js/tests/unit/tests-polyfills.js
Normal file
28
js/tests/unit/tests-polyfills.js
Normal 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
|
||||
}
|
||||
})()
|
Reference in New Issue
Block a user