]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Update tooltip.js
authorMichael J. Ryan <tracker1@gmail.com>
Mon, 14 Mar 2016 20:18:08 +0000 (13:18 -0700)
committerMichael J. Ryan <tracker1@gmail.com>
Mon, 14 Mar 2016 20:18:08 +0000 (13:18 -0700)
Don't reference `Tether` via attachment to `window`, with the update one can import bootstrap providing the dependencies in webpack with:

```
new webpack.ProvidePlugin({
  $: 'jquery',
  jQuery: 'jquery',
  Tether: 'tether',
});
```

Then inside one's own bootstrap/globals, `import 'bootstrap';` will simply work, and $/jQuery can be used from there.

I had wanted to do this, but also expose jQuery, Tether, etc when in development build in my code, but if I provide `window.Tether`, I can't then expose it to the outside...

js/src/tooltip.js

index 77803dc402ad9adb3610f49c6a5c6d7d29d26a91..03d9e4cc8e89bc35361cc23322f5064fc37ef97a 100644 (file)
@@ -16,7 +16,7 @@ const Tooltip = (($) => {
    * Check for Tether dependency
    * Tether - http://github.hubspot.com/tether/
    */
-  if (window.Tether === undefined) {
+  if ('undefined' === typeof Tether) {
     throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)')
   }