Pro Javascript Techniques

John Resig knows Javascript.

The first chapter gives a broad overview of the major topics the book will cover: object-orientated programming, testing, DOM scripting, event handling, CSS, Ajax and browser support. The second chapter starts right into object-orientated programming, including the major features of JavaScript in this area.

In Created Reusable code (chapter three) the book looks at the way of simulating inheritance, namespaces and other features found in other OO-languages, but not found natively in JavaScript. They also introduce the Prototype, Dojo and Yahoo! YUI libraries. Finally, the chapter covers compressing your code with JSMin and Packer, then ends off with JSAN (the JavaScript Archive Network, a collection of Open Source JavaScript libraries and software).

Chapter four is on tools for debugging. This covers the various built-in debugging capabilities of Internet Explorer, Firefox, Safari and Opera as well as some add-ons like FireBug, Safari’s web extension and the Venkman debugger. They also cover testing frameworks like JsUnit and newer testing frameworks like J3Unit.

The next three chapters look at manipulating the visual presentation of documents. Starting with the document object model (DOM), the chapter looks at ways of reading, traversing and modifying a page’s DOM. This is followed by a look at events and the chapter covers: the Event object’s methods, threading, callbacks and changing default actions, as well as gracefully degrading in case the user has JavaScript disabled. In the CSS section, how JavaScript can access CSS properties and change them is covered. Specifically, the section looks at changing elements’ position and visibility before looking into the simple DOM-Drag library and how this can be done with Moo.fx, the author’s jQuery and the script.aculo.us libraries.

READ  Open Government

The next two chapters look at putting the work in the previous three chapters to use. Improving forms start with a basic user login-type form and covers how JavaScript can perform various types of validation and improve usability. Finally, chapter nine is on building and image gallery by modifying the Lightbox gallery.

Chapter 10 introduces AJAX and covers the major components of it: HTTP requests, serializing data, handling response data and errors. It then presents a small library for working with Javascript’s XMLHttpRequest later on to two examples of an RSS feed and injecting HTML into a page.

The next three chapters then present examples of using AJAX. The enhancing blogs chapter shows how to build a blog that appends older entries as the user scrolls down the page and updating a user’s page with new items without refreshing the page. The chapter on auto-completing fields shows how to create auto-complete forms such as those found on Google and del.icio.us. Finally, the Ajax Wiki chapter builds a wiki written in Javascript, Ruby and SQLite (for the server-side) making use of the jQuery and Prototype libraries.

The last chapter looks at the future of JavaScript, covering some of the features in 1.6, 1.7 and what might be in Javascript 2.0. There is then some coverage of the Web Applications 1.0 document and one of its recommendations- the Canvas tag, already supported on some browsers. The chapter wraps up with a bit of an introduction to Comet.

The book ends with three appendices on the DOM, events and an overview of the major browsers.

READ  The Cult of the Amateur