Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
08679ac0
Commit
08679ac0
authored
6 years ago
by
Johann-S
Committed by
XhmikosR
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add back support for IE 11
parent
f7c1b1e6
4 merge requests
!31948
Examples/Floating-labels: fix bad behavior with autofill
,
!30064
test
,
!28882
fix custom-select-indicator in IE10
,
!28721
Hot test
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
build/build-plugins.js
+2
-14
build/build-plugins.js
js/src/button.js
+8
-2
js/src/button.js
js/src/dom/eventHandler.js
+3
-3
js/src/dom/eventHandler.js
js/src/dom/polyfill.js
+121
-58
js/src/dom/polyfill.js
js/src/dom/selectorEngine.js
+3
-4
js/src/dom/selectorEngine.js
js/src/util/index.js
+4
-1
js/src/util/index.js
js/tests/browsers.js
+7
-0
js/tests/browsers.js
js/tests/karma.conf.js
+6
-3
js/tests/karma.conf.js
js/tests/unit/modal.js
+18
-7
js/tests/unit/modal.js
js/tests/unit/tests-polyfills.js
+28
-0
js/tests/unit/tests-polyfills.js
with
200 additions
and
92 deletions
+200
-92
build/build-plugins.js
+
2
-
14
View file @
08679ac0
...
@@ -31,7 +31,6 @@ const bsPlugins = {
...
@@ -31,7 +31,6 @@ const bsPlugins = {
Data
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/data.js
'
),
Data
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/data.js
'
),
EventHandler
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/eventHandler.js
'
),
EventHandler
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/eventHandler.js
'
),
Manipulator
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/manipulator.js
'
),
Manipulator
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/manipulator.js
'
),
Polyfill
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/polyfill.js
'
),
SelectorEngine
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/selectorEngine.js
'
),
SelectorEngine
:
path
.
resolve
(
__dirname
,
'
../js/src/dom/selectorEngine.js
'
),
Alert
:
path
.
resolve
(
__dirname
,
'
../js/src/alert.js
'
),
Alert
:
path
.
resolve
(
__dirname
,
'
../js/src/alert.js
'
),
Button
:
path
.
resolve
(
__dirname
,
'
../js/src/button.js
'
),
Button
:
path
.
resolve
(
__dirname
,
'
../js/src/button.js
'
),
...
@@ -69,7 +68,8 @@ function getConfigByPluginKey(pluginKey) {
...
@@ -69,7 +68,8 @@ function getConfigByPluginKey(pluginKey) {
if
(
if
(
pluginKey
===
'
Data
'
||
pluginKey
===
'
Data
'
||
pluginKey
===
'
Manipulator
'
||
pluginKey
===
'
Manipulator
'
||
pluginKey
===
'
Polyfill
'
||
pluginKey
===
'
EventHandler
'
||
pluginKey
===
'
SelectorEngine
'
||
pluginKey
===
'
Util
'
||
pluginKey
===
'
Util
'
||
pluginKey
===
'
Sanitizer
'
pluginKey
===
'
Sanitizer
'
)
{
)
{
...
@@ -79,17 +79,6 @@ function getConfigByPluginKey(pluginKey) {
...
@@ -79,17 +79,6 @@ function getConfigByPluginKey(pluginKey) {
}
}
}
}
if
(
pluginKey
===
'
EventHandler
'
||
pluginKey
===
'
SelectorEngine
'
)
{
return
{
external
:
[
bsPlugins
.
Polyfill
],
globals
:
{
[
bsPlugins
.
Polyfill
]:
'
Polyfill
'
}
}
}
if
(
pluginKey
===
'
Alert
'
||
pluginKey
===
'
Tab
'
)
{
if
(
pluginKey
===
'
Alert
'
||
pluginKey
===
'
Tab
'
)
{
return
defaultPluginConfig
return
defaultPluginConfig
}
}
...
@@ -161,7 +150,6 @@ function build(plugin) {
...
@@ -161,7 +150,6 @@ function build(plugin) {
'
Data
'
,
'
Data
'
,
'
EventHandler
'
,
'
EventHandler
'
,
'
Manipulator
'
,
'
Manipulator
'
,
'
Polyfill
'
,
'
SelectorEngine
'
'
SelectorEngine
'
]
]
...
...
This diff is collapsed.
Click to expand it.
js/src/button.js
+
8
-
2
View file @
08679ac0
...
@@ -166,12 +166,18 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, eve
...
@@ -166,12 +166,18 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, eve
EventHandler
.
on
(
document
,
Event
.
FOCUS_DATA_API
,
Selector
.
DATA_TOGGLE_CARROT
,
event
=>
{
EventHandler
.
on
(
document
,
Event
.
FOCUS_DATA_API
,
Selector
.
DATA_TOGGLE_CARROT
,
event
=>
{
const
button
=
SelectorEngine
.
closest
(
event
.
target
,
Selector
.
BUTTON
)
const
button
=
SelectorEngine
.
closest
(
event
.
target
,
Selector
.
BUTTON
)
button
.
classList
.
add
(
ClassName
.
FOCUS
)
if
(
button
)
{
button
.
classList
.
add
(
ClassName
.
FOCUS
)
}
})
})
EventHandler
.
on
(
document
,
Event
.
BLUR_DATA_API
,
Selector
.
DATA_TOGGLE_CARROT
,
event
=>
{
EventHandler
.
on
(
document
,
Event
.
BLUR_DATA_API
,
Selector
.
DATA_TOGGLE_CARROT
,
event
=>
{
const
button
=
SelectorEngine
.
closest
(
event
.
target
,
Selector
.
BUTTON
)
const
button
=
SelectorEngine
.
closest
(
event
.
target
,
Selector
.
BUTTON
)
button
.
classList
.
remove
(
ClassName
.
FOCUS
)
if
(
button
)
{
button
.
classList
.
remove
(
ClassName
.
FOCUS
)
}
})
})
/**
/**
...
...
This diff is collapsed.
Click to expand it.
js/src/dom/eventHandler.js
+
3
-
3
View file @
08679ac0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
import
{
jQuery
as
$
}
from
'
../util/index
'
import
{
jQuery
as
$
}
from
'
../util/index
'
import
Polyfill
from
'
./polyfill
'
import
{
createCustomEvent
,
defaultPreventedPreservedOnDispatch
}
from
'
./polyfill
'
/**
/**
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
...
@@ -305,7 +305,7 @@ const EventHandler = {
...
@@ -305,7 +305,7 @@ const EventHandler = {
evt
=
document
.
createEvent
(
'
HTMLEvents
'
)
evt
=
document
.
createEvent
(
'
HTMLEvents
'
)
evt
.
initEvent
(
typeEvent
,
bubbles
,
true
)
evt
.
initEvent
(
typeEvent
,
bubbles
,
true
)
}
else
{
}
else
{
evt
=
new
CustomEvent
(
event
,
{
evt
=
create
CustomEvent
(
event
,
{
bubbles
,
bubbles
,
cancelable
:
true
cancelable
:
true
})
})
...
@@ -326,7 +326,7 @@ const EventHandler = {
...
@@ -326,7 +326,7 @@ const EventHandler = {
if
(
defaultPrevented
)
{
if
(
defaultPrevented
)
{
evt
.
preventDefault
()
evt
.
preventDefault
()
if
(
!
Polyfill
.
defaultPreventedPreservedOnDispatch
)
{
if
(
!
defaultPreventedPreservedOnDispatch
)
{
Object
.
defineProperty
(
evt
,
'
defaultPrevented
'
,
{
Object
.
defineProperty
(
evt
,
'
defaultPrevented
'
,
{
get
:
()
=>
true
get
:
()
=>
true
})
})
...
...
This diff is collapsed.
Click to expand it.
js/src/dom/polyfill.js
+
121
-
58
View file @
08679ac0
/* istanbul ignore file */
/**
/**
* --------------------------------------------------------------------------
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): dom/polyfill.js
* Bootstrap (v4.3.1): dom/polyfill.js
...
@@ -7,83 +9,144 @@
...
@@ -7,83 +9,144 @@
import
{
getUID
}
from
'
../util/index
'
import
{
getUID
}
from
'
../util/index
'
/* istanbul ignore next */
let
{
matches
,
closest
}
=
Element
.
prototype
const
Polyfill
=
(()
=>
{
let
find
=
Element
.
prototype
.
querySelectorAll
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
let
findOne
=
Element
.
prototype
.
querySelector
const
defaultPreventedPreservedOnDispatch
=
(()
=>
{
let
createCustomEvent
=
(
eventName
,
params
)
=>
{
const
e
=
new
CustomEvent
(
'
Bootstrap
'
,
{
const
cEvent
=
new
CustomEvent
(
eventName
,
params
)
cancelable
:
true
})
const
element
=
document
.
createElement
(
'
div
'
)
return
cEvent
element
.
addEventListener
(
'
Bootstrap
'
,
()
=>
null
)
}
e
.
preventDefault
()
if
(
typeof
window
.
CustomEvent
!==
'
function
'
)
{
element
.
dispatchEvent
(
e
)
createCustomEvent
=
(
eventName
,
params
)
=>
{
return
e
.
defaultPrevented
params
=
params
||
{
bubbles
:
false
,
cancelable
:
false
,
detail
:
null
}
})()
let
find
=
Element
.
prototype
.
querySelectorAll
const
evt
=
document
.
createEvent
(
'
CustomEvent
'
)
let
findOne
=
Element
.
prototype
.
querySelector
const
scopeSelectorRegex
=
/:scope
\b
/
evt
.
initCustomEvent
(
eventName
,
params
.
bubbles
,
params
.
cancelable
,
params
.
detail
)
const
supportScopeQuery
=
(()
=>
{
return
evt
const
element
=
document
.
createElement
(
'
div
'
)
}
}
try
{
const
workingDefaultPrevented
=
(()
=>
{
element
.
querySelectorAll
(
'
:scope *
'
)
const
e
=
document
.
createEvent
(
'
CustomEvent
'
)
}
catch
(
error
)
{
return
false
e
.
initEvent
(
'
Bootstrap
'
,
true
,
true
)
e
.
preventDefault
()
return
e
.
defaultPrevented
})()
if
(
!
workingDefaultPrevented
)
{
const
origPreventDefault
=
Event
.
prototype
.
preventDefault
Event
.
prototype
.
preventDefault
=
function
()
{
if
(
!
this
.
cancelable
)
{
return
}
}
return
true
origPreventDefault
.
call
(
this
)
})()
Object
.
defineProperty
(
this
,
'
defaultPrevented
'
,
{
get
()
{
return
true
},
configurable
:
true
})
}
}
if
(
!
supportScopeQuery
)
{
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
find
=
function
(
selector
)
{
const
defaultPreventedPreservedOnDispatch
=
(()
=>
{
if
(
!
scopeSelectorRegex
.
test
(
selector
))
{
const
e
=
createCustomEvent
(
'
Bootstrap
'
,
{
return
this
.
querySelectorAll
(
selector
)
cancelable
:
true
}
}
)
const
hasId
=
Boolean
(
this
.
id
)
const
element
=
document
.
createElement
(
'
div
'
)
element
.
addEventListener
(
'
Bootstrap
'
,
()
=>
null
)
if
(
!
hasId
)
{
e
.
preventDefault
()
this
.
id
=
getUID
(
'
scope
'
)
element
.
dispatchEvent
(
e
)
}
return
e
.
defaultPrevented
})()
if
(
!
matches
)
{
matches
=
Element
.
prototype
.
msMatchesSelector
||
Element
.
prototype
.
webkitMatchesSelector
}
let
nodeList
=
null
if
(
!
closest
)
{
try
{
closest
=
function
(
selector
)
{
selector
=
selector
.
replace
(
scopeSelectorRegex
,
`#
${
this
.
id
}
`
)
let
element
=
this
nodeList
=
this
.
querySelectorAll
(
selector
)
}
finally
{
do
{
if
(
!
hasId
)
{
if
(
matches
.
call
(
element
,
selector
))
{
this
.
removeAttribute
(
'
id
'
)
return
element
}
}
}
return
nodeList
element
=
element
.
parentElement
||
element
.
parentNode
}
while
(
element
!==
null
&&
element
.
nodeType
===
1
)
return
null
}
}
const
scopeSelectorRegex
=
/:scope
\b
/
const
supportScopeQuery
=
(()
=>
{
const
element
=
document
.
createElement
(
'
div
'
)
try
{
element
.
querySelectorAll
(
'
:scope *
'
)
}
catch
(
error
)
{
return
false
}
return
true
})()
if
(
!
supportScopeQuery
)
{
find
=
function
(
selector
)
{
if
(
!
scopeSelectorRegex
.
test
(
selector
))
{
return
this
.
querySelectorAll
(
selector
)
}
}
findOne
=
function
(
selector
)
{
const
hasId
=
Boolean
(
this
.
id
)
if
(
!
scopeSelectorRegex
.
test
(
selector
))
{
return
this
.
querySelector
(
selector
)
}
const
matches
=
find
.
call
(
this
,
selector
)
if
(
!
hasId
)
{
this
.
id
=
getUID
(
'
scope
'
)
}
if
(
typeof
matches
[
0
]
!==
'
undefined
'
)
{
let
nodeList
=
null
return
matches
[
0
]
try
{
selector
=
selector
.
replace
(
scopeSelectorRegex
,
`#
${
this
.
id
}
`
)
nodeList
=
this
.
querySelectorAll
(
selector
)
}
finally
{
if
(
!
hasId
)
{
this
.
removeAttribute
(
'
id
'
)
}
}
return
null
}
}
}
return
{
return
nodeList
defaultPreventedPreservedOnDispatch
,
find
,
findOne
}
}
})()
export
default
Polyfill
findOne
=
function
(
selector
)
{
if
(
!
scopeSelectorRegex
.
test
(
selector
))
{
return
this
.
querySelector
(
selector
)
}
const
matches
=
find
.
call
(
this
,
selector
)
if
(
typeof
matches
[
0
]
!==
'
undefined
'
)
{
return
matches
[
0
]
}
return
null
}
}
export
{
createCustomEvent
,
find
,
findOne
,
matches
,
closest
,
defaultPreventedPreservedOnDispatch
}
This diff is collapsed.
Click to expand it.
js/src/dom/selectorEngine.js
+
3
-
4
View file @
08679ac0
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* --------------------------------------------------------------------------
* --------------------------------------------------------------------------
*/
*/
import
Polyfill
from
'
./polyfill
'
import
{
find
as
findFn
,
findOne
,
matches
,
closest
}
from
'
./polyfill
'
import
{
makeArray
}
from
'
../util/index
'
import
{
makeArray
}
from
'
../util/index
'
/**
/**
...
@@ -14,12 +14,11 @@ import { makeArray } from '../util/index'
...
@@ -14,12 +14,11 @@ import { makeArray } from '../util/index'
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
*/
*/
const
{
find
:
findFn
,
findOne
}
=
Polyfill
const
NODE_TEXT
=
3
const
NODE_TEXT
=
3
const
SelectorEngine
=
{
const
SelectorEngine
=
{
matches
(
element
,
selector
)
{
matches
(
element
,
selector
)
{
return
element
.
matches
(
selector
)
return
matches
.
call
(
element
,
selector
)
},
},
find
(
selector
,
element
=
document
.
documentElement
)
{
find
(
selector
,
element
=
document
.
documentElement
)
{
...
@@ -72,7 +71,7 @@ const SelectorEngine = {
...
@@ -72,7 +71,7 @@ const SelectorEngine = {
return
null
return
null
}
}
return
element
.
closest
(
selector
)
return
closest
.
call
(
element
,
selector
)
},
},
prev
(
element
,
selector
)
{
prev
(
element
,
selector
)
{
...
...
This diff is collapsed.
Click to expand it.
js/src/util/index.js
+
4
-
1
View file @
08679ac0
...
@@ -71,7 +71,10 @@ const getTransitionDurationFromElement = element => {
...
@@ -71,7 +71,10 @@ const getTransitionDurationFromElement = element => {
}
}
const
triggerTransitionEnd
=
element
=>
{
const
triggerTransitionEnd
=
element
=>
{
element
.
dispatchEvent
(
new
Event
(
TRANSITION_END
))
const
evt
=
document
.
createEvent
(
'
HTMLEvents
'
)
evt
.
initEvent
(
TRANSITION_END
,
true
,
true
)
element
.
dispatchEvent
(
evt
)
}
}
const
isElement
=
obj
=>
(
obj
[
0
]
||
obj
).
nodeType
const
isElement
=
obj
=>
(
obj
[
0
]
||
obj
).
nodeType
...
...
This diff is collapsed.
Click to expand it.
js/tests/browsers.js
+
7
-
0
View file @
08679ac0
...
@@ -30,6 +30,13 @@ const browsers = {
...
@@ -30,6 +30,13 @@ const browsers = {
browser
:
'
Edge
'
,
browser
:
'
Edge
'
,
browser_version
:
'
latest
'
browser_version
:
'
latest
'
},
},
ie11Win10
:
{
base
:
'
BrowserStack
'
,
os
:
'
Windows
'
,
os_version
:
'
10
'
,
browser
:
'
IE
'
,
browser_version
:
'
11.0
'
},
chromeWin10
:
{
chromeWin10
:
{
base
:
'
BrowserStack
'
,
base
:
'
BrowserStack
'
,
os
:
'
Windows
'
,
os
:
'
Windows
'
,
...
...
This diff is collapsed.
Click to expand it.
js/tests/karma.conf.js
+
6
-
3
View file @
08679ac0
...
@@ -79,8 +79,9 @@ if (bundle) {
...
@@ -79,8 +79,9 @@ if (bundle) {
conf
.
detectBrowsers
=
detectBrowsers
conf
.
detectBrowsers
=
detectBrowsers
files
=
files
.
concat
([
files
=
files
.
concat
([
jqueryFile
,
jqueryFile
,
'
js/tests/unit/tests-polyfills.js
'
,
'
dist/js/bootstrap.js
'
,
'
dist/js/bootstrap.js
'
,
'
js/tests/unit/
*
.js
'
'
js/tests/unit/
!(tests-polyfills)
.js
'
])
])
}
else
if
(
browserStack
)
{
}
else
if
(
browserStack
)
{
conf
.
hostname
=
ip
.
address
()
conf
.
hostname
=
ip
.
address
()
...
@@ -97,6 +98,7 @@ if (bundle) {
...
@@ -97,6 +98,7 @@ if (bundle) {
reporters
.
push
(
'
BrowserStack
'
)
reporters
.
push
(
'
BrowserStack
'
)
files
=
files
.
concat
([
files
=
files
.
concat
([
jqueryFile
,
jqueryFile
,
'
js/tests/unit/tests-polyfills.js
'
,
'
js/coverage/dist/util/util.js
'
,
'
js/coverage/dist/util/util.js
'
,
'
js/coverage/dist/util/sanitizer.js
'
,
'
js/coverage/dist/util/sanitizer.js
'
,
'
js/coverage/dist/dom/polyfill.js
'
,
'
js/coverage/dist/dom/polyfill.js
'
,
...
@@ -107,7 +109,7 @@ if (bundle) {
...
@@ -107,7 +109,7 @@ if (bundle) {
'
js/coverage/dist/dom/!(polyfill).js
'
,
'
js/coverage/dist/dom/!(polyfill).js
'
,
'
js/coverage/dist/tooltip.js
'
,
'
js/coverage/dist/tooltip.js
'
,
'
js/coverage/dist/!(util|index|tooltip).js
'
,
// include all of our js/dist files except util.js, index.js and tooltip.js
'
js/coverage/dist/!(util|index|tooltip).js
'
,
// include all of our js/dist files except util.js, index.js and tooltip.js
'
js/tests/unit/
*
.js
'
,
'
js/tests/unit/
!(tests-polyfills)
.js
'
,
'
js/tests/unit/dom/*.js
'
,
'
js/tests/unit/dom/*.js
'
,
'
js/tests/unit/util/*.js
'
'
js/tests/unit/util/*.js
'
])
])
...
@@ -121,6 +123,7 @@ if (bundle) {
...
@@ -121,6 +123,7 @@ if (bundle) {
)
)
files
=
files
.
concat
([
files
=
files
.
concat
([
jqueryFile
,
jqueryFile
,
'
js/tests/unit/tests-polyfills.js
'
,
'
js/coverage/dist/util/util.js
'
,
'
js/coverage/dist/util/util.js
'
,
'
js/coverage/dist/util/sanitizer.js
'
,
'
js/coverage/dist/util/sanitizer.js
'
,
'
js/coverage/dist/dom/polyfill.js
'
,
'
js/coverage/dist/dom/polyfill.js
'
,
...
@@ -131,7 +134,7 @@ if (bundle) {
...
@@ -131,7 +134,7 @@ if (bundle) {
'
js/coverage/dist/dom/!(polyfill).js
'
,
'
js/coverage/dist/dom/!(polyfill).js
'
,
'
js/coverage/dist/tooltip.js
'
,
'
js/coverage/dist/tooltip.js
'
,
'
js/coverage/dist/!(util|index|tooltip).js
'
,
// include all of our js/dist files except util.js, index.js and tooltip.js
'
js/coverage/dist/!(util|index|tooltip).js
'
,
// include all of our js/dist files except util.js, index.js and tooltip.js
'
js/tests/unit/
*
.js
'
,
'
js/tests/unit/
!(tests-polyfills)
.js
'
,
'
js/tests/unit/dom/*.js
'
,
'
js/tests/unit/dom/*.js
'
,
'
js/tests/unit/util/*.js
'
'
js/tests/unit/util/*.js
'
])
])
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/modal.js
+
18
-
7
View file @
08679ac0
...
@@ -731,7 +731,14 @@ $(function () {
...
@@ -731,7 +731,14 @@ $(function () {
})
})
QUnit
.
test
(
'
should enforce focus
'
,
function
(
assert
)
{
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
done
=
assert
.
async
()
var
$modal
=
$
([
var
$modal
=
$
([
...
@@ -759,14 +766,18 @@ $(function () {
...
@@ -759,14 +766,18 @@ $(function () {
done
()
done
()
}
}
document
.
addEventListener
(
'
focusin
'
,
focusInListener
)
if
(
isIE11
)
{
done
()
}
else
{
document
.
addEventListener
(
'
focusin
'
,
focusInListener
)
var
focusInEvent
=
new
Event
(
'
focusin
'
)
var
focusInEvent
=
new
Event
(
'
focusin
'
)
Object
.
defineProperty
(
focusInEvent
,
'
target
'
,
{
Object
.
defineProperty
(
focusInEvent
,
'
target
'
,
{
value
:
$
(
'
#qunit-fixture
'
)[
0
]
value
:
$
(
'
#qunit-fixture
'
)[
0
]
})
})
document
.
dispatchEvent
(
focusInEvent
)
document
.
dispatchEvent
(
focusInEvent
)
}
})
})
.
bootstrapModal
(
'
show
'
)
.
bootstrapModal
(
'
show
'
)
})
})
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/tests-polyfills.js
0 → 100644
+
28
-
0
View file @
08679ac0
// 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
}
})()
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets