Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/src/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ const Alert = (() => {

return Alert

})($)
})(Util.jQuery)

export default Alert
4 changes: 3 additions & 1 deletion js/src/button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import $ from 'jquery'
import Util from './util'

/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-beta.2): button.js
Expand Down Expand Up @@ -182,6 +184,6 @@ const Button = (() => {

return Button

})($)
})(Util.jQuery)

export default Button
2 changes: 1 addition & 1 deletion js/src/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,6 @@ const Carousel = (() => {

return Carousel

})($)
})(Util.jQuery)

export default Carousel
2 changes: 1 addition & 1 deletion js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,6 @@ const Collapse = (() => {

return Collapse

})($)
})(Util.jQuery)

export default Collapse
2 changes: 1 addition & 1 deletion js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,6 @@ const Dropdown = (() => {

return Dropdown

})($, Popper)
})(Util.jQuery, Popper)

export default Dropdown
2 changes: 1 addition & 1 deletion js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Util from './util'
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
}
})($)
})(Util.jQuery)

export {
Util,
Expand Down
2 changes: 1 addition & 1 deletion js/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,6 @@ const Modal = (() => {

return Modal

})($)
})(Util.jQuery)

export default Modal
3 changes: 2 additions & 1 deletion js/src/popover.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import $ from 'jquery'
import Tooltip from './tooltip'
import Util from './util'


/**
Expand Down Expand Up @@ -189,6 +190,6 @@ const Popover = (() => {

return Popover

})($)
})(Util.jQuery)

export default Popover
2 changes: 1 addition & 1 deletion js/src/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,6 @@ const ScrollSpy = (() => {

return ScrollSpy

})($)
})(Util.jQuery)

export default ScrollSpy
2 changes: 1 addition & 1 deletion js/src/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,6 @@ const Tab = (() => {

return Tab

})($)
})(Util.jQuery)

export default Tab
2 changes: 1 addition & 1 deletion js/src/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,6 @@ const Tooltip = (() => {

return Tooltip

})($, Popper)
})(Util.jQuery, Popper)

export default Tooltip
4 changes: 4 additions & 0 deletions js/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const Util = (() => {
}
}
}
},

get jQuery() {
return window.jQuery || window.$
}
}

Expand Down
1 change: 1 addition & 0 deletions js/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<script src="unit/tab.js"></script>
<script src="unit/tooltip.js"></script>
<script src="unit/popover.js"></script>
<script src="unit/util.js"></script>
</head>
<body>
<div id="qunit-container">
Expand Down
19 changes: 19 additions & 0 deletions js/tests/unit/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(function () {
'use strict'

QUnit.module('Util')

QUnit.test('Util.jQuery should find window.jQuery if window.$ is not available', function (assert) {
assert.expect(1)
delete window.$
assert.strictEqual(Util.jQuery, window.jQuery)
window.$ = Util.jQuery
})

QUnit.test('Util.jQuery should find window.$ if window.jQuery is not available', function (assert) {
assert.expect(1)
delete window.jQuery
assert.strictEqual(Util.jQuery, window.$)
window.jQuery = Util.jQuery
})
})