]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Throw error about Popper.js only when it's needed because some of our plugins don...
authorJohann-S <johann.servoire@gmail.com>
Sun, 29 Oct 2017 22:51:04 +0000 (23:51 +0100)
committerMark Otto <markd.otto@gmail.com>
Sun, 29 Oct 2017 22:51:04 +0000 (15:51 -0700)
js/src/dropdown.js
js/src/tooltip.js

index 45d061c93a96aa6aeb6f3390dd68542ff47089d8..a18f0c28aeea035a58e77314de7b25d66430902a 100644 (file)
@@ -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)) {
index a3fc93c9137dab605d07a9e4ee3ae6fdec9f5ac6..7cefd0be6aa170fbf7938001d2ee5af9e11b9a27 100644 (file)
@@ -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