From 2232b6b4d140cf8a01314deb7e4779c7fde8ab05 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Sun, 29 Oct 2017 23:51:04 +0100 Subject: [PATCH] Throw error about Popper.js only when it's needed because some of our plugins don't use it (#24573) --- js/src/dropdown.js | 16 ++++++++-------- js/src/tooltip.js | 16 +++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) 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