Skip to content

Commit 2232b6b

Browse files
Johann-Smdo
authored andcommitted
Throw error about Popper.js only when it's needed because some of our plugins don't use it (#24573)
1 parent e454c8e commit 2232b6b

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

js/src/dropdown.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ import Util from './util'
1212

1313
const Dropdown = (($) => {
1414

15-
/**
16-
* Check for Popper dependency
17-
* Popper - https://popper.js.org
18-
*/
19-
if (typeof Popper === 'undefined') {
20-
throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)')
21-
}
22-
2315
/**
2416
* ------------------------------------------------------------------------
2517
* Constants
@@ -151,6 +143,14 @@ const Dropdown = (($) => {
151143
return
152144
}
153145

146+
/**
147+
* Check for Popper dependency
148+
* Popper - https://popper.js.org
149+
*/
150+
if (typeof Popper === 'undefined') {
151+
throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)')
152+
}
153+
154154
let element = this._element
155155
// for dropup with alignment we use the parent as popper container
156156
if ($(parent).hasClass(ClassName.DROPUP)) {

js/src/tooltip.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ import Util from './util'
1212

1313
const Tooltip = (($) => {
1414

15-
/**
16-
* Check for Popper dependency
17-
* Popper - https://popper.js.org
18-
*/
19-
if (typeof Popper === 'undefined') {
20-
throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)')
21-
}
22-
23-
2415
/**
2516
* ------------------------------------------------------------------------
2617
* Constants
@@ -120,6 +111,13 @@ const Tooltip = (($) => {
120111
class Tooltip {
121112

122113
constructor(element, config) {
114+
/**
115+
* Check for Popper dependency
116+
* Popper - https://popper.js.org
117+
*/
118+
if (typeof Popper === 'undefined') {
119+
throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)')
120+
}
123121

124122
// private
125123
this._isEnabled = true

0 commit comments

Comments
 (0)