-
-
Notifications
You must be signed in to change notification settings - Fork 78.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to jQuery 2.x.x. #17494
Switch to jQuery 2.x.x. #17494
Conversation
What about updating the package metadata? ( |
I think they already use 2 in some places but I'll keep it consistent. |
Nope, bower.json has Unless you mean require 2.x as the minimum version which in that case we'll need to change the version in the error message we throw when jQuery isn't available. |
48cc642
to
f9eca82
Compare
👍 |
358a734
to
1d9c047
Compare
Cleaned the branch up a little bit. |
d07682e
to
97f269e
Compare
So, what do we do with this? Merge it as is, or change the version in the error message we throw too? |
97f269e
to
22c799b
Compare
Yeah that's what I'm suggesting, since BSv4 doesn't support IE<9 anyway. |
All right, I'll make the changes and ping you again. |
b4d0f3e
to
ed61cf8
Compare
Personally, LGTM. |
Up to @fat honestly. |
ed61cf8
to
82944f8
Compare
Now that we don't support IE 8 it's safe to do that.
82944f8
to
9eded91
Compare
Ping @fat otherwise I think we should merge it if everyone else agrees. |
👍 |
I know this is not Bootstraps problem but....WordPress has no plans to move to jQuery v2. Now that BS v4 depends on jQuery v2 is this going to become a problem for theme developers who want to use BS v4? I noticed that if jQuery v2+ is not loaded we now get a console message. Can BS4 work with jQuery V1.11.X ? |
Yes it can (after all we used 1.11.3 until now), but I guess there's no guarantee in the long term. jQuery 2.x is out for a long time now, and honestly, we should really start ignoring ancient browsers. It's 2015, almost 2016, in an era that browsers are developing rapidly, not like 10 years ago. Maybe the WordPress guys will reconsider for their next major version to start using jQuery 2.x by default. By then we might have jQuery 3.x anyway... |
I don't quite understand why you prevent using jQuery 1.x with Bootstrap v4. The only difference is, that 2.x doesn't support IE 6-8. It's not like 2.x has a feature which is actually required by Bootstrap.
Probably not, because of the missing benefit. |
Is there any chance of not making jQuery 2.x a minimum requirement for Boostrap 4? |
Well, first of all, we shouldn't really use jQuery at all. But that is a task that requires a lot of hours and has its own drawbacks. That being said, there is no gain for us to use 1.x since we don't support old browsers. It's simple like that. If one wants to use 1.x, they can the same way someone might use Ruby 1.9.3, or node.js 0.8 and so on. Things might work there but we don't test them thus can't support them. Anyway, /CC @cvrebert if you have something to add. |
You make some great points and from a BS perspective it makes perfect sense. But from a theme developers point of view, with Bootstrap v4 now throwing an error if jQuery < 2 (commit 9eded91) will lead developers to unhook the WP jQuery to include v2 instead. Deregistering the WP version of jQuery is considered bad practice. Is there some middle ground? Ship BS4 with jQuery v2, but allow v1.9.x without the error message? |
That was my original patch if you check the comments on the top.
|
+1 For keep supporting version v1 of jQuery because its a causes nightmares if you start to replace jQuery on WordPress sites. Its rightfully highly discouraged by WP people who know what they are talking about. Considering the tons of bootstrap based themes and plugins out there this would cause a lot of pain. Correct me if I am wrong but isn't there no difference between jQuery v1 and v2 besides that v2 has code removed that is needed for IE <= 8 ? So bootstrap4 not actually uses, and will not use any new functions because there are none. So why demand it and throw a error when there is no reason to do so? |
Bootstrap does not currently use any exclusively jQuery v2 features, but that is not a guarantee that it will always be that way. If your site, such as a Wordpress site, continues to require jQuery v1, then there is not currently any harm falling back to v1. Just install v1 instead of v2 and you're good to go., as @XhmikosR has previously stated. For sites that do not have a dependency on v1, depending on v2 makes sense. It's a smaller library in large part because it removes a lot of support for older browers, browsers that are no longer supported by Bootstrap in v4. 👍 on this merge, as far as I'm concerned, but I also do think we can remove the error from Bootstrap, too. The dependency is already defined elsewhere and Bootlint might be a better place to warn Bootstrap users of the version mismatch. |
any chance that this could be reverted? breaking JS for sites running jquery 1.x.x when bootstrap doesn't use anything from jquery 2 seems wrong. like others have mentioned, this is now a problem for anyone that uses wordpress.
i wouldn't count on that happening any time soon.
^^^ this. |
😳 Love it or hate it, a lot of us make a living with WP, and this is super bad news. |
I don't really follow the reasoning for throwing an error. If jQuery 2.x support were necessary, then sure. But as far as I know, there aren't any new features in jQuery 2.x yet over 1.11.x If it were possible to use new features in the future of jQuery 2, I could understand pushing this now. However, since there are no new features in jQuery 2, it seems a little premature to require it when there are no new features and we're not really sure when/if new features that Bootstrap can use will be available. I can understand making the dependency jQuery 2, but throwing an error seems premature and unnecessary. |
If this is how it's going to be then I won't be able to use Bootstrap 4 and that would be a shame. |
I think WP themes should stick with older version of bootstrap (v2, v3) and forget v4 (which right now is not released yet). Otherwise this will stimulate them to continue jQuery 1.x.x forever. |
i think WP should support jquery 2.x.x, and in the meantime we will go back to enqueueing it ourselves no way that we are not going to use v4. been using it for a while now and it's great. Sent from my iPhone
|
While this is bad news for WordPress devs, I don't think Bootstrap's job is to comply with all WordPress rules. It's like saying to a car manufacturer that his new car sounds cool but does fit in your current parking spot. The manufacturer proposes a car "as-is" with its many options; if you want it, you'll have to adapt your parking... @retlehs, in your Roots / Soil projects, you already deregister WordPress's "original" jQuery to replace it with the same version of jQuery, but from a CDN (see https://github.com/roots/soil/blob/4e9ad4562e1592c49f1f3a26c4dad1e00500c0c0/modules/jquery-cdn.php#L15). So basically, a WP theme developer could use the same technique to load jQuery 2 instead of jQuery 1 (as you also explain on roots.io forum, or as you mention just above). Yet, doing that, the WP-theme developer would have to deal with situations like "my BS4/jquery2-based theme is not compatible with this or that jquery1-based plugin". Again, this announces headaches for WP devs, but I think this is out of scope for Bootstrap. The only "solution" to this would be to lobby WordPress guys to use jQuery 2.x.x. |
yes, but the points brought up earlier in this thread are still relevant:
|
Agreed @retlehs, throwing an error is a (maybe too) strong move. But it may make really more sense if jQuery's team puts features in 2.x.x, leaving 1.x.x without these features. |
More like saying that the new work van doesn't work on the roads I deliver to. Or something. Analogies can only go so far.
This. The error "Bootstrap's JavaScript requires jQuery version 2" isn't actually true...yet. |
Well we should get away from analogies and focus on the bare reasoning behind this approach. These are the arguments for using jQuery 2:~12% lower file size.jQuery 1.11.2 minified and gzipped: 33,321 bytes (32.54 KB). Modular builds
This would be a really good argument but you guys aren't even using this feature. Notably absent from the above arguments:"jQuery might add new features"This is not a good reason whatsoever. This is not even an argument, it's baseless speculation. jQuery 2.0 is 100% backwards compatible with 1.0 and there are no plans to change this. Why would jQuery break backwards compat after hundreds of manhours backporting fixes to 1.x? Even the roadmap for jQuery 3.0 looks tame as far as backwards compatibility. RecommendationThere is no reason at all why an error should be thrown. Again: there are zero reasons to disallow jQuery 1.x to be used with bootstrap. Ignoring the fact that IE8 still has an 11% market share and WordPress is used by 25% of the top 10 million Alexa ranked websites: there is simply no argument for breaking compatibilty with jQuery 1.x. jQuery 1.x and 2.x are API compatible on purpose. Why would you limit the flexibility of bootstrap arbitrarily like this? Sauces: |
@cvrebert: so, what should we do with this? |
We're backpedaling on this; see #18267. |
Now that we don't support IE 8 it's safe to do that.
I also fixed the inconsistent jQuery version used in some examples (1.11.1 vs 1.11.3 in others)/CC @cvrebert @fat @mdo @hnrch02