Learning jQuery

Author: Ralph Steyer
Publisher: Addison-Wesley
Pages: 512
ISBN: 978-0321815262
Audience: JavaScript programmers
Rating: 3
Reviewer: Ian Elliot

This book has the subtitle A Hands-on Guide to Building Rich Interactive Web Front Ends. Does it live up to expectation?

 

jQuery is almost the standard library for JavaScript so you need to know something about it. This book aims to cover everything - jQuery, jQuery UI and jQuery Mobile. There is an argument that all three libraries are so different they really only share the jQuery name and really don't need to be covered in a single book. jQuery UI gets a single chapter as does Mobile which isn't really enough for either of them.

Ralph Steyer starts of with some introductory chapters. The first chapter is very general. It helps you download jQuery and it suggests an IDE - Aptana. My favourite IDE is NetBeans, but this isn't a problem. The second chapter is called First Examples With jQuery and the first example is titled - Accessing Elements and Protecting the DOM. Here we hit the first big problem. I have no idea what "protecting the DOM" means. After very much reading between the lines it seems to be used in the sense of avoiding differences between browsers. Why this is protecting the DOM I'm not at all sure.

This was just the first of some very strange ways of expressing ideas that make the book much harder to read than it should be. If you know what the topic is about then the effect is slightly surreal; if you don't know what the topic is about then you really aren't going to get much help from the strange vocabulary. There are also some strange uses of jargon. For example, HTML is DHML or XTML with no mention of the ever trendy HTML5 which replaces both. 

Chapter 3 moves on to explains "Basic Knowledge" which turns out to be a very odd selection of web technologies - JavaScript, CSS, Ajax, XML, JSON and the DOM again. The explanations are very superficial and the example of JSON is particularly worrying as a JSON string is converted to an object using EVAL which is never a good idea. JSON strings should always be sanitized or restricted in what is legal. The use of EVAL is even stranger when you consider that jQuery has a safe parseJSON method - which is covered in chapter 10.  At this point I was not only confused by the language and descriptions I was beginning to mistrust the information. 

The description of the DOM was also puzzling:

"This is a kind of tree in the computer's main memory, that is constructed on loading the web page and deleted again when the user leaves the site."

OK, but it's not a kind of tree; it is a tree data structure of nodes and it is deleted when the user leaves the page not the site. Then we have:

"Similar elements are managed together in a field when the browser indexes them."

I have been pondering what this might mean for some time and have to say I give up. 

When the chapter moves on to consider CSS things get even worse:

"Style sheets do not constitute a separate language, but merely a concept."

Well if you are talking about CSS 3 it is as close to a separate language as you can get, not that chapter actually mentions CSS 3.

 

learningjquery

 

Chapter 4 is a bit more practical and focused but despite being called "How jQuery Works" it is actually "How you use jQuery". Unfortunately it doesn't focus on the aspect that most jQuery beginners are most concerned about - selectors. It spends a lot of time discussing issues that could be left until later and skirts around the matter of selectors which it leaves for Chapter 5. For reasons that aren't very clear the topic is then discussed in terms of Xpath, which you can quite happily ignore when using jQuery. 

Chapter 6 is about accessing elements and Chapter 7 is formatting with style sheets. Chapter 8 looks at event handling and Chapter 9 covers effects and animation. The final chapter on jQuery proper deals with Ajax. From here we move on to the UI and creating plugins. The chapter on mobile is too short to do any good but it might give you some idea whether or not you want to find out more. 

Overall this isn't a book that is going to help a beginner see the logic behind any of the the technologies it describes. It seems to jump from topic to topic without really putting anything into context. Most of the examples are larger than they need be to show the principle being illustrated. You don't need a complete web page to show jQuery selecting and working with an element, say. When you put all this together with the strange language used and the round about way of describing things then the conclusion has to be that there are books on jQuery that are more helpful and easier to read. 

 

Last Updated ( Wednesday, 14 May 2014 )