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:
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.