diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 45d061c93a96..a18f0c28aeea 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -12,14 +12,6 @@ import Util from './util' const Dropdown = (($) => { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ - if (typeof Popper === 'undefined') { - throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)') - } - /** * ------------------------------------------------------------------------ * Constants @@ -151,6 +143,14 @@ const Dropdown = (($) => { return } + /** + * Check for Popper dependency + * Popper - https://popper.js.org + */ + if (typeof Popper === 'undefined') { + throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)') + } + let element = this._element // for dropup with alignment we use the parent as popper container if ($(parent).hasClass(ClassName.DROPUP)) { diff --git a/js/src/tooltip.js b/js/src/tooltip.js index a3fc93c9137d..7cefd0be6aa1 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -12,15 +12,6 @@ import Util from './util' const Tooltip = (($) => { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ - if (typeof Popper === 'undefined') { - throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)') - } - - /** * ------------------------------------------------------------------------ * Constants @@ -120,6 +111,13 @@ const Tooltip = (($) => { class Tooltip { constructor(element, config) { + /** + * Check for Popper dependency + * Popper - https://popper.js.org + */ + if (typeof Popper === 'undefined') { + throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)') + } // private this._isEnabled = true