At the time I wrote these books, jQuery was the most popular library available. In fact, both books emphasize use of jQuery for programming needs. It turns out that jQuery is still the most popular library around and for good reason, the producers of jQuery have done just about everything right, so developers continue to support them. If you need general interface and low level programming support, jQuery and jQuery UI are good places to start. What it really comes down to is reducing costs and getting work done faster. Money drives everything on the Internet, including your next project.
Two libraries simply can’t meet every need. Developers often use a wide variety of libraries to get the job done. Choosing the right library can be difficult. There are literally hundreds of them, all purporting to do the job faster, better, and for less money (when money is directly involved in the equation). Choosing the wrong library can incur huge penalties. That’s why a site such as Libscore is so important. You can use Libscore to find the top:
The last option is the most important because it tells you what the top sites are and which libraries they use to achieve their goals. By viewing the site and seeing how it uses a library, you can make intelligent decisions for your own site. Exploring Libscore doesn’t take long, but can net you huge gains in productivity that translate into reduced costs and fewer errors.
The easiest way to fix this problem is to use a version of jQuery that does support this property. The change is relatively small. All you need to do is change the line that reads
The change will force the application to use an older version of the jQuery library. As an alternative, you can also add a call to the jQuery migrate library so that the code looks like this:
<title>Detect a Browser</title>
The jQuery site recommends using feature detection instead. Although this feature is directly supported in the latest version of jQuery, there are problems with it as well. The most important issue to consider is that the site tells you outright that the library might have certain features pulled without notice or with a long deprecation cycle, which means that you code could simply stop working at some point. It’s a poor way to detect the kind of browser that you’re using because it’s unreliable. The technique shown in Chapter 2 of the book is far more reliable at the moment.
The point of this post is that there aren’t any absolutes when it comes to coding practice. You need to know when to break the rules. Let me know if you encounter any difficulties with my solution to the problem at John@JohnMuellerBooks.com. If someone has a better jQuery-oriented solution to share, contact me because I’d love to hear about it.
A number of readers who know that I work extensively with jQuery have written to tell me about changes to the support it provides for older versions of browsers. In fact, you can read about these changes in a recent InfoWorld article, “jQuery 2.0 drops support for old versions of Internet Explorer.” The article title is misleading because there are also apparently changes for other browsers such as Firefox and Chrome as well. My advise is to test your application to ensure it actually works as anticipated with the browsers you want to support before you upgrade to jQuery 2.0 in a production environment.
Of course, the concern from readers is that the code in my books will suddenly stop running in their browsers. There is no need for concern. Even though the examples in my latest book have an URL that points to http://code.jquery.com/jquery-latest.js, if you follow the link you’ll find that it actually uses the 1.9.1 version of the library, not the 2.0 version. If you want to be absolutely certain you won’t encounter any problems, you can always change this URL to http://code.jquery.com/jquery-1.9.1.js, which ensures you’ll continue using the 1.9.1 version no matter how the library changes its site.
As to whether I plan to use the new version of the library in upcoming books, it depends on what I see as trends in the market and requests that I receive from readers. As things are now, I probably won’t visit the 2.0 version in my books unless readers specifically request it. Even then, the majority of examples in my books will continue to use the 1.9.1 version until such time as the older browsers it supports lack sufficient market presence to make it a worthwhile tradeoff to continue using the older library. In other words, I’ll continue to support the version of the library that works for most people.
As I work more and more often with Web apps (applications), rather than Windows-specific applications, I have become aware of the tremendous amount of developer support that’s available for anyone on any platform when creating this application type. It’s possible for someone who works predominantly on the Mac to write code that works just fine for someone who works most of the time on a Windows system. In fact, the entire idea of platform becomes meaningless when working with Web apps. jQuery and jQuery UI are a huge part of the third party support available to anyone writing Web apps. In fact, it’s hard to find Web apps of any size that don’t rely on these two libraries (many examples of smaller applications do exist).
Of course, you might wonder why jQuery and jQuery UI are so successful. My experience is that these libraries are incredibly well written, work with a wide variety of browsers, are well supported, and provide great documentation. Most importantly, the two libraries provide developers with needed functionality and flexibility. It’s possible to create a unique application using just these libraries with well-documented tweaks and event handlers. In short, these two libraries have everything needed to create a successful library—one that everyone will enjoy using.
There are many other libraries available to Web developers and I plan to explore many more of them as time permits. I find it interesting that even if I were to devote myself entirely to working through all of the available libraries, there probably wouldn’t be time to explore them all. That’s why I’d like to know about your favorite library and why you find this particular library so useful. I’m not interested in hearing about something mundane—the library needs to do something special, such as providing functionality not found in other libraries currently available. I’m looking for libraries that are well documented and are used by a wide variety of developers to create great looking Web apps. Let me know about the library of your dreams at John@JohnMuellerBooks.com.