]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Change Rollup config to wrap our dist files with jQuery instead of $
authorJohann-S <johann.servoire@gmail.com>
Tue, 24 Oct 2017 08:12:45 +0000 (10:12 +0200)
committerJohann-S <johann.servoire@gmail.com>
Tue, 24 Oct 2017 10:39:25 +0000 (12:39 +0200)
15 files changed:
build/rollup.config.js
js/src/alert.js
js/src/button.js
js/src/carousel.js
js/src/collapse.js
js/src/dropdown.js
js/src/index.js
js/src/modal.js
js/src/popover.js
js/src/scrollspy.js
js/src/tab.js
js/src/tooltip.js
js/src/util.js
js/tests/index.html
js/tests/unit/util.js [deleted file]

index 9faeb08826bbd5ba0fee4d9351db5017e9fdc24a..f9a4706160987ae34d2b13903baa7e6b83af1195 100644 (file)
@@ -20,7 +20,7 @@ const plugins = [
   })
 ]
 const globals = {
-  jquery: '$',
+  jquery: 'jQuery', // ensure we use jQuery which is always available even in noConflict mode
   'popper.js': 'Popper'
 }
 
index 2b967145f682f76af25364f540a7a56097c0b6cd..8d52e1591ba006c1e3ae1f1155f228a2d02ede53 100644 (file)
@@ -9,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Alert = (() => {
+const Alert = (($) => {
 
 
   /**
@@ -189,6 +189,6 @@ const Alert = (() => {
 
   return Alert
 
-})(Util.jQuery)
+})($)
 
 export default Alert
index 87e724346fb018afc3b6ea7b1632842636922a46..5632998a3f61c811d47ebe46da7047e4d742403e 100644 (file)
@@ -1,5 +1,4 @@
 import $ from 'jquery'
-import Util from './util'
 
 /**
  * --------------------------------------------------------------------------
@@ -8,7 +7,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Button = (() => {
+const Button = (($) => {
 
 
   /**
@@ -184,6 +183,6 @@ const Button = (() => {
 
   return Button
 
-})(Util.jQuery)
+})($)
 
 export default Button
index b5cbf98b48fd6e431dd49391714374ddf5b5c8a0..10ed2203edeb8ff3a39d06f5a2e637fc2154fb51 100644 (file)
@@ -9,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Carousel = (() => {
+const Carousel = (($) => {
 
 
   /**
@@ -519,6 +519,6 @@ const Carousel = (() => {
 
   return Carousel
 
-})(Util.jQuery)
+})($)
 
 export default Carousel
index 9a21eb7d81496d91f6606f9bd00edbd1c219c029..f907aec54d82017e4a4d8f1c62821d57427d9193 100644 (file)
@@ -9,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Collapse = (() => {
+const Collapse = (($) => {
 
 
   /**
@@ -404,6 +404,6 @@ const Collapse = (() => {
 
   return Collapse
 
-})(Util.jQuery)
+})($)
 
 export default Collapse
index 48f87c5aa19e66dbba610f51307467f9984c0bc0..e3331ac183f6c3e191ecc31695601c171c3d6c45 100644 (file)
@@ -10,7 +10,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Dropdown = (() => {
+const Dropdown = (($) => {
 
   /**
    * Check for Popper dependency
@@ -445,6 +445,6 @@ const Dropdown = (() => {
 
   return Dropdown
 
-})(Util.jQuery, Popper)
+})($, Popper)
 
 export default Dropdown
index 1697a709b7b2acb5bf315fecf99e8a6381899a17..51d09b4e2994552b3911d74f6567f2953ffd0c4c 100644 (file)
@@ -18,7 +18,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-(() => {
+(($) => {
   if (typeof $ === 'undefined') {
     throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.')
   }
@@ -33,7 +33,7 @@ import Util from './util'
   if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
     throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
   }
-})(Util.jQuery)
+})($)
 
 export {
   Util,
index cb7bef0ce3154712147ba632d10c427b913dd3c3..95565aabccebf0d545789ee84caa1ccd44902b93 100644 (file)
@@ -9,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Modal = (() => {
+const Modal = (($) => {
 
 
   /**
@@ -585,6 +585,6 @@ const Modal = (() => {
 
   return Modal
 
-})(Util.jQuery)
+})($)
 
 export default Modal
index 28cb511fc83d36d84f7b0c3a2b86be44672b751a..4fb96a792e7dcdf2e17b0d3e4386dc3a5b2ca5c2 100644 (file)
@@ -1,6 +1,5 @@
 import $ from 'jquery'
 import Tooltip from './tooltip'
-import Util from './util'
 
 
 /**
@@ -10,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Popover = (() => {
+const Popover = (($) => {
 
 
   /**
@@ -190,6 +189,6 @@ const Popover = (() => {
 
   return Popover
 
-})(Util.jQuery)
+})($)
 
 export default Popover
index 12667cc95710e383780d6a8dc10c6197c4313992..3a13d954ac572887b726a1bc5cdcb4138ab7a1ba 100644 (file)
@@ -9,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const ScrollSpy = (() => {
+const ScrollSpy = (($) => {
 
 
   /**
@@ -335,6 +335,6 @@ const ScrollSpy = (() => {
 
   return ScrollSpy
 
-})(Util.jQuery)
+})($)
 
 export default ScrollSpy
index f1d9ec0c82c46d9f1d52ccc5f6a0db1f7f062895..1d4178687d6c6c034ee311b39e2d15a211f002df 100644 (file)
@@ -9,7 +9,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Tab = (() => {
+const Tab = (($) => {
 
 
   /**
@@ -282,6 +282,6 @@ const Tab = (() => {
 
   return Tab
 
-})(Util.jQuery)
+})($)
 
 export default Tab
index 39ef2594b9338287fcbecb8bceea5be166fca16f..a3fc93c9137dab605d07a9e4ee3ae6fdec9f5ac6 100644 (file)
@@ -10,7 +10,7 @@ import Util from './util'
  * --------------------------------------------------------------------------
  */
 
-const Tooltip = (() => {
+const Tooltip = (($) => {
 
   /**
    * Check for Popper dependency
@@ -728,6 +728,6 @@ const Tooltip = (() => {
 
   return Tooltip
 
-})(Util.jQuery, Popper)
+})($, Popper)
 
 export default Tooltip
index 1fa55494ea9a213168c54c4edba1cad95dfc0109..71f93a7c502d0d74121e5b002f1d157de7b1f961 100644 (file)
@@ -7,7 +7,7 @@ import $ from 'jquery'
  * --------------------------------------------------------------------------
  */
 
-const Util = (() => {
+const Util = (($) => {
 
 
   /**
@@ -152,10 +152,6 @@ const Util = (() => {
           }
         }
       }
-    },
-
-    get jQuery() {
-      return window.jQuery || window.$
     }
   }
 
index 0385b8a2baf11746fe4be982bc8c1e1a18b76931..2383fce6e6d7088878b09354384ba04154c31e32 100644 (file)
     <script src="unit/tab.js"></script>
     <script src="unit/tooltip.js"></script>
     <script src="unit/popover.js"></script>
-    <script src="unit/util.js"></script>
   </head>
   <body>
     <div id="qunit-container">
diff --git a/js/tests/unit/util.js b/js/tests/unit/util.js
deleted file mode 100644 (file)
index c341204..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-$(function () {
-  'use strict'
-
-  QUnit.module('Util')
-
-  QUnit.test('Util.jQuery should find window.jQuery if window.$ is not available', function (assert) {
-    assert.expect(1)
-    delete window.$
-    assert.strictEqual(Util.jQuery, window.jQuery)
-    window.$ = Util.jQuery
-  })
-
-  QUnit.test('Util.jQuery should find window.$ if window.jQuery is not available', function (assert) {
-    assert.expect(1)
-    delete window.jQuery
-    assert.strictEqual(Util.jQuery, window.$)
-    window.jQuery = Util.jQuery
-  })
-})