Reputation: 1
My project uses jQuery 1.4.4.
But I just downloaded a jQuery plugin and it has a copy of jQuery 1.3.2 bundled with it.
Will it create any conflicts if I include both versions of jQuery in my project?
How do I know if this plugin really really needs version 1.3.2?
And what should I do if it really really needs it?
Upvotes: 0
Views: 536
Reputation:
But I just downloaded a jQuery plugin and it has a copy of jQuery 1.3.2 bundled with it.
Will it create any conflicts if I include both versions of jQuery in my project?
It depends on how it is "bundled" load ordering can be to ensure the correct object in jQuery
at time of the plug-in loading. If the plugin correctly captures the current jQuery instance, it should not be an issue. If the plug-in is done "correctly" it will be wrapped like:
;(function ($) {
...
}(jQuery)
There is no need to use noConflict
here which affects the $
shortcut. If the plug-in is correctly bound this does not apply. If it is not correctly bound, best move on. If the plug-in works with 1.4.4, then don't even bother with 1.3.2, of course :-)
How do I know if this plugin really really needs version 1.3.2?
The documentation is the best bet. However, just trying it and seeing may be the most practical option (it would be my first step).
And what should I do if it really really needs it?
Load ordering as per above and testing -- or hacking it to work -- or getting a newer/different plug-in as a replacement.
Happy coding.
Upvotes: 0
Reputation: 29658
How do I know if this plugin really really needs version 1.3.2?
Just try it out with the version you are using. If it works, it works.
Will it create any conflicts if I include both versions of jQuery in my project?
I believe you can include multiple versions of jQuery by writing:
var oldVersion = $.noConflict();
This restores $
to whatever it was before that version of jQuery was loaded. So, when you load the most recent version, it assumes $
. But, you might have to modify the plugin so it uses the correct $
or oldVersion
. If the plugin was designed correctly, it will most likely use a closure where this kind of change is easy to do.
Upvotes: 2
Reputation: 10371
@Hhorati Fhutanz: Try running the plugin without the bundled older version. If it works, no worries. If it's somehow dependent on an older version of jQuery, you should probably ditch it or post which plugin it is so people can let you know if there's a similar or better plugin.
Upvotes: 2
Reputation: 19380
Remove 1.3.2 and try with 1.4.4, it should work, they are not that different. Maybe 1.3.2 was latest at the time plugin author released it.
Upvotes: 1
Reputation: 18798
You should include the latest release. jQuery releases keep stable plug-in dependencies.
Upvotes: 0