Skip to content

Commit

Permalink
Throw error about Popper.js only when it's needed because some of our…
Browse files Browse the repository at this point in the history
… plugins don't use it (#24573)
  • Loading branch information
Johann-S authored and mdo committed Oct 29, 2017
1 parent e454c8e commit 2232b6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
16 changes: 8 additions & 8 deletions js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down
16 changes: 7 additions & 9 deletions js/src/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2232b6b

Please sign in to comment.