| || || |
| || |
| || || |
EDIT: Sorry I didn't mention this before, but the website that accompanies this book, http://book.learningjquery.com/ is an excellent resource for hands-on understanding of the code in the book. It also fills in some of the knowledge gaps that I discuss below.
This book is a must have for anyone that is serious about effectively leveraging jQuery in their applications. While the API is very simple, it is also extremely robust and powerful. Even when you think you have a good grasp on how things work, reading a manual like this points out all the little facets that you didn't know existed; whether it be optional method arguments or miscellaneous selectors, you probably aren't writing code as effectively as you could be, and you can't do that until you have at least a general understanding of all the features that jQuery makes available.
One of the great things that this book does, which is rare for an API-style book, is to explain, when possible, what the jQuery API is using behind the scenes to access and traverse the document object model. For instance, it explains that the getElementsByTagName() is used to filter tag-based selectors and that getElementById() is used to filter id-based selectors. While this might not seem important to understand, and after all, the whole point of encapsulation is so that you don't NEED to understand, it can become very useful in terms of optimization. For example, $( "#pagetitle" ) is going to be faster than $( "h1#pagetitle" ) since it can use the direct ID access rather than tag-based filtering. Also, $( "h2.title" ) is going to be faster than $( ".title" ) since it can use the tag-based filtering and not have to iterate over every DOM element looking for a particular class.
In addition to covering the full jQuery API, this book also contains a cursory exploration of the architecture and authoring of custom plug-ins. While the book thoroughly covers basic plug-in authoring, I wish that they had covered some more complex stuff; but, at the same time I think that that probably would be more appropriate for a plug-in based book rather than a general reference manual such as this one.
After discussing plug-in architecture, this book also explores two popular jQuery plug-ins: Dimensions and Form. The dimensions plug-in enhances the built-in height() and width() object methods that already exist. It also introduces a host of other methods that allow developers to find the dimensions and position of elements with the conditional incorporation of various CSS box model properties. The Form plug-in contains many methods that make it super easy to submit a form using AJAX, including many utility methods that assist in the serialization and accessing of form data.
The book does a good job of explaining how the individual Dimensions methods work, especially the height and width related calculations. The position related methods, while explained in depth, left me confused; the demo HTML used in the chapter is explicitly incomplete and this makes it difficult to visualize where the calculated numbers are coming from. It wasn't until I went to the demo site (http://book.learningjquery.com) that the calculations became clear. Even then, however, you can see that as much as the jQuery plug-ins try to encapsulate the cross-browser issues, there are still problems to be found. For example, calling $('div.dim-outer').offset() returned a LEFT value of 580 in FireFox 2.0 and a LEFT value of 1116 in Internet Explorer 6.0.
The book does a good job of explaining how the individual Form plug-in methods work. And, while I am not one who does a lot of AJAX form submission, I can see how using this plug-in would make that a painless process. Regardless, this plug-in also contains some great utility functions that allow you to grab form data at any given time. This can be useful for partial form updates such as the common two-selected-related scenario. My one gripe with this section is the same issue I have throughout the reference manual: callback arguments are not explained very well. With the form submission process, there are two callbacks available - beforeSubmit and success. Both methods are explained in natural language terms, but only the beforeSubmit method gets a code sample explanation (seven pages after it was explained in english). I don't know about you, but seeing a snippet of code is 10 times more clear than the equivalent natural language description.
This is very nit-picky, but as much as I loved this book, there were a few things that were not perfect; while the majority of the selectors are thoroughly explained, the big exception is the Form selectors. I have gone over this section several times and I just can't quite figure out what it means. The big problem is that unlike the rest of the book, the form selectors have no code samples; it's just be a list of input types, but not listed in any meaningful way. This section feels like an afterthought in the book.
I also felt that some of the callback methods could have been better explained. Most of the jQuery callback methods have arguments passed to them, but unless they were used in the examples, they were not defined as part of the callback function definition. I would rather have seen every argument explicitly defined, whether it was used or not, so that we as developers could see what our options were.
The only other problem with this book is that the jQuery technology is evolving so fast that the most recent release of jQuery (v.1.2.1 at the time of this writing) already has things that are not covered in this book. Not only that, a few of the things that are covered in this book, namely the XPath style selectors, are no longer supported by the core jQuery API (but rather though small plug-ins).
Looking For A New Job?
- AngularJS Content Creators at AngularJobs.com
- Senior Coldfusion Developer - Remote Position at MeetingPlay
- ColdFusion Developer at WRIS Web Services
- ColdFusion Developer at GAP Solutions, Inc.
- Expert Coldfusion Developer with extensive Microsoft Media Services expertise at Atprime Media Services
Wow, Ben, great review. And thanks. Hopefully you've posted it to Amazon as well (just checked and it's not there, but maybe it's in the process of being approved). Saw John Farrar's review there. Go CF community! :-)
Thanks! Yeah, I posted it to Amazon as well (my first every Amazon review) and apparently they have a 1-2 day approval time line. Hopefully should be up early this week.
You should post this to the jQuery mailing list (unless Rey beats you to it!)
I'm sure the book authors would appreciate the feedback.
Hey Ben and other jQuery'ers,
@ Josh Nathanson
Thanks Josh for the hinting me to John Resig's book - just started reading and until now it´s a fantastic read
This has probably saved me a few hours of searching. Thanks!
What is the best way to learn jQuery? By reading books?
Thank you Josh for the hinting me to John Resig's book.
I will buy this book soon to learn that stuff.
I am trying to learn Jquery now. I am an ASP.net developer and know Ajax. Jquery makes everything much simpler and required less resources from my database. Thanks for the review. I will try to get a copy soon.
Thank you for another essential article. Where else could anyone get that kind of information in such a complete way of writing?
I may read this book as well. For awhile, I have wanted to learn C++ but I believe that Java is better and more relevant.
Self publishing services