I'm a bit stuck here. I have a website that currently uses jQuery 2.1.4 only. I just figured out it won't support older browsers such as IE 6, 7 and 8. I use jQuery for many things in my website, which includes login system, live chat and some management functions.
Anyway, I was thinking of implementing jQuery 1.11.3 because it supports these browsers. Thing is, I don't really know where to start from because I don't think I simply add another script source for jQuery 1.11.3 and it shall fix it all, but I'm looking for a way to add it so I won't have to change all my functions or add special functions just for older browsers.
The only jQuery methods I use are $.ajax, $.when and $.then.
I don't think I simply add another script source for jQuery 1.11.3 and it shall fix it all
You just replace the existing script source with it.
The 2.1.x branch is just the 1.11 branch with all the slow compatibility code for old browsers removed. They are API compatible.
Related
Just a conceptual question. Does the migrate plugin search through the javascript files pulled in by the browser? Or does the migrate plugin only look through code that is being executed by the server?
I need to use the jquery migrate plugin to update my code to the latest version of jquery. I'm trying to replace all instances of code stripped away in previous version and replace it with the latest ones.
From jQuery migrate docs:
Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used.
That way you can spot and fix what otherwise would have been errors, until you no longer need jQuery Migrate and can remove it.
Does it look through your files? No. It only warns when deprecated methods have been called from within your code
On many places, I found that jQuery is made on top of JavaScript. So the browser that supports JavaScript would definitely support jQuery.
But the page on Wiki https://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks#Browser_support suggests browser support was added at its specific version. I am also confused on the statement at https://en.wikipedia.org/wiki/JQuery#Browser_support
May be I am unnecessarily confused, but this is a bit causing me headache.
Can anyone please tell me about this?
JavaScript: It supports directly. we don't require to add any library file.
Jquery: While we are using jquery, we have to add jquery library file. Without library, browser won't understand jquery script. Each library version, covers new feature of browser. so based on broswer version, we can use specific version's jquery library.
Hi I got this error in IE. It works in all other browsers.
This is the line where error shows:
if (parseFloat(totalnumm.replace(/[^0-9-.]/g,'')) > compare_value_neww && values[x].indexOf("Custom") > -1 ).
I googled and found one solution:
<meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
But it did not work for me.
I was going to ask what version of IE you're testing this in, but since you've specified content="IE=8 in your meta tags, that's fairly irrelevant.
The short answer is that .indexOf for arrays is not supported in IE8 or earlier. (That includes later IE versions in compatibility mode, so your meta tag will mean that it won't work in any IE version)
Solutions:
Use a library like jQuery (or similar) which supplies an .inArray() method that you can use instead.
You'll then need to change your code from using var.indexOf(x) to $.inArray(var,x)
Pick this solution if you're already using jQuery (or another library that has this feature).
Use a polyfill library like this one that adds the standard .indexOf method to the Array prototype.
This should allow you to keep your existing code unchanged; just include the library.
Use this solution if you are happy to use a library but you haven't got one already installed that would help.
Write your own function that does the same job using a for() loop.
This is a complete change in how you find things in your arrays, but does mean you don't need to use any extra libraries.
Use this solution if you don't want to (or can't, for whatever reason) use a third-party library.
Remove your IE8 meta tag (it's pretty bad anyway, so that's a good idea) and only support your site for users with IE9 or better.
Use this solution if you're happy to stop supporting older IE versions.
In fact, it would be a good idea to do this anyway; there's no good reason to be using the meta tag to force IE into compatibility mode. Better to set it to content="IE=edge". That will remove the problem entirely for newer IE versions. If you do need to support IE8 or earlier, then this solution won't solve the problem and you'll need to also use one of the other solutions above, but I'd still recommend doing it anyway, because as things stand you are deliberately removing features from newer IE versions for no good reason.
What happened is that we have a page that was previously working then all of sudden some scripts no longer work (for some reason). We figured out that we needed to use the latest jQuery library to fix the problem.
So we were thinking to just link to http://code.jquery.com/jquery-latest.min.js so that it's always updated.
However, we are also aware that if we will always use the latest jQuery library, the new version might cause some problems on other older scripts.
What is the best way to link the jQuery library then to minimize these types of issues?
Save the stable version of the library to your local/server and link to it. That's all.
It is a bad idea to link to http://code.jquery.com/jquery-latest.min.js
Jquery latest version always available in,
http://code.jquery.com/jquery-latest.js
For Latest Min Jquery, use
http://code.jquery.com/jquery-latest.min.js
To get latest jquery from other hosts, follow jquerylatest.com
We have had issues with Mootools not being very backward compatible specifically in the area of drag and drop functionality. I was wondering if anyone has had any similar problems with jQuery not being backward compatible. We are starting to use it quite heavily and are thinking about upgrading to a newer version to start using several plugins that require it. Will we have any issues if we get rid of the older version?
jQuery seems to be nicely backward compatible. I have been using it for more than a couple of years now through several versions of the core and have not had issues when upgrading except a few minor ones with some plugins. I would say that the core seems to be fine but if you're using a lot of plugins you might run into some problems (but these are usually easy to fix, or the new core has that functionality built in anyway so you can just drop them).
jQuery is so serious about backwards compatibility that they produce a "backwards compatibility" plugin for each release: http://docs.jquery.com/Release:jQuery_1.2#jQuery_1.1_Compatibility_Plugin. It let people who don't need backwards compatibility save on page weight.
My experience is that when upgrading, I sometimes find that stuff that used to work breaks. For instance, when upgrading from 1.7.2 to 1.8.3 I found some drag-and-drop features stopped working. Some problems may be due to deprecated jQuery functions being dropped, still in use by incompatible versions of jQuery UI.
Here is a quote from another user:
Backward compatibility may not be the jQuery team’s strong suit, but
as with most things, it’s a work in progress. I’m not meaning to
disparage the great work they do, but it points out the fact that you
simply must always test your scripts with new versions of jQuery.
jQuery has produced backwards compatibility plugins since version 1.0.
Web development has changed a lot over the years, and jQuery has changed along with it. Through all of this time, the team has tried to walk the line between maintaining compatibility with code from the past versus supporting the best web development practices of the present.
The project has the following backwards compatibility repos:
jquery-compat-1.0(Compatibility plugin for those upgrading to jQuery 1.1+ from jQuery 1.0)
jquery-compat-1.1(Compatibility plugin for those upgrading to jQuery 1.2+ from jQuery 1.1)
jquery-xpath(Implement XPath functionality for those upgrading to jQuery 1.2 from jQuery 1.1)
jquery-compat-1.3(Backwards compatibility plugin for jQuery 1.3 (to be used with jQuery 1.4))
jquery-migrate-1.x-stable(Migrate older jQuery code to jQuery 1.9+)
jquery-migrate(Migrate older jQuery code to jQuery 3.0+)
References
jQuery Blog
jQuery Wiki: Won't Fix
jQuery Core Upgrade Guides
jQuery Migrate Plugin - Warning Messages (2.0)
jQuery Migrate Plugin - Warning Messages (3.0)
jqLint
In my experience, jQuery 1.x has been very backwards-compatible until version 1.9.
The jQuery 1.x line had major changes as of jQuery 1.9.0. We strongly recommend that you also use the jQuery Migrate plugin if you are upgrading from pre-1.9 versions of jQuery or need to use plugins that haven't yet been updated. Read the jQuery 1.9 Upgrade Guide and the jQuery 1.9 release blog post for more information.
And don't upgrade to 2.0 until you're sure that this isn't an issue for you:
jQuery 2.x has the same API as jQuery 1.x, but does not support Internet Explorer 6, 7, or 8.