From d763d019ad3f61bb78c85f9dc2f7b842c8357e71 Mon Sep 17 00:00:00 2001 From: XhmikosR <xhmikosr@gmail.com> Date: Thu, 19 Oct 2017 19:02:27 +0300 Subject: [PATCH] Make 1.9.1 the minimum jQuery version again. (#24434) --- docs/4.0/migration.md | 2 +- js/src/index.js | 12 ++++++++---- package.json | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/4.0/migration.md b/docs/4.0/migration.md index bad3738a29..e5a4c6130e 100644 --- a/docs/4.0/migration.md +++ b/docs/4.0/migration.md @@ -17,7 +17,7 @@ While in beta, we aim to have no breaking changes. However, things don't always - Renamed `.table-inverse`, `.thead-inverse`, and `.thead-default` to `.*-dark` and `.*-light`, matching our color schemes used elsewhere. - Responsive tables now generate classes for each grid breakpoint. This breaks from Beta 1 in that the `.table-responsive` you've been using is more like `.table-responsive-md`. You may now use `.table-responsive` or `.table-responsive-{sm,md,lg,xl}` as needed. - Dropped Bower support as the package manager has been deprecated for alternatives (e.g., Yarn or npm). [See bower/bower#2298](https://github.com/bower/bower/issues/2298) for details. -- Bootstrap now requires jQuery 3.0.0 or higher. +- Bootstrap still requires jQuery 1.9.1 or higher, but you're advised to use version 3.x since v3.x's supported browsers are the ones Bootstrap supports plus v3.x has some security fixes. - Removed the unused `.form-control-label` class. If you did make use of this class, it was duplicate of the `.col-form-label` class that vertically centered a `<label>` with it's associated input in horizontal form layouts. - Changed the `color-yiq` from a mixin that included the `color` property to a function that returns a value, allowing you to use it for any CSS property. For example, instead of `color-yiq(#000)`, you'd write `color: color-yiq(#000);`. diff --git a/js/src/index.js b/js/src/index.js index 2629e507fc..f30b94c576 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -24,10 +24,14 @@ import Util from './util' } const version = $.fn.jquery.split(' ')[0].split('.') - const min = 3 - const max = 4 - if (version[0] < min || version[0] >= max) { - throw new Error('Bootstrap\'s JavaScript requires at least jQuery v3.0.0 but less than v4.0.0') + const minMajor = 1 + const ltMajor = 2 + const minMinor = 9 + const minPatch = 1 + const maxMajor = 4 + + 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') } })($) diff --git a/package.json b/package.json index 2e533f8731..303448fae3 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "license": "MIT", "dependencies": {}, "peerDependencies": { - "jquery": "^3.0.0", + "jquery": "1.9.1 - 3", "popper.js": "^1.12.3" }, "devDependencies": { -- GitLab