Slashdot Mirror


JavaScript : The Definitive Guide, 4th Edition

briandonovan writes "A new edition? Given all of the changes in the web programming landscape since the 1998 publication of the previous edition, David Flanagan's JavaScript : The Definitive Guide (JS:TDG4), 4th Edition was overdue. Flanagan delivers a book that more than measures up to its predecessor - JS:TDG4 includes a substantial amount of new material and, as a whole, has been extensively updated. The crushing gain in browser market share by Microsoft's Internet Explorer offering, the maturation of the Netscape 6.x,7.x / Mozilla browser suite and its entry into the fray along with a slew of other Gecko-based browsers, promulgation of newer versions of the ECMAScript specification (accompanied by new implementations in JavaScript and JScript), and the publication of successive W3C DOM Recommendations are all reflected in this edition." JavaScript : The Definitive Guide, 4th Edition author David Flanagan pages 916 publisher O'Reilly rating 9 reviewer Brian Donovan ISBN 0596000480 summary The latest edition of JavaScript : The Definitive Guide brings the popular reference up to date with extensive coverage of W3C DOM Level 1 and 2 and a much-improved and expanded set of appendices.

The Book in a Nutshell

Although much of the core of the language, addressed in Part I, has changed relatively little since JS:TDG3, Flanagan has added coverage of new issues that have emerged in the past several years, like the discussion of ASCII, Latin-1, and 16-bit Unicode in the beginning of Chapter 2 (ECMA-262 Edition 1, the spec that defined ECMAScript, included Unicode support for il8n purposes, so ECMAScript compliance requires Unicode support), and pruned away quite a bit of material related to NS 4.x-proprietary features, like the explanation of import and export (previously found in Chapter 6), that are naturally of increasingly less interest to developers as that line of browsers recedes into history. Much of Part II, which considers client-side JavaScript and DOM in all its glory, is entirely new or has been completely re-written. Where the chapter on the Document Object model in the 3rd edition only covered the "Level 0" DOM (the objects, properties, and methods first exposed by the 4.0 browsers), JS:TDG4 tackles the Level 0 DOM and the W3C DOM Recommendations through level 1 Core and HTML and touches on some DOM Level 2 topics, including the Range and Traversal APIs. "Cascading Style Sheets and Dynamic HTML" and "Events and Event Handling" are two other chapters in the Client-Side JavaScript section that have really come into their own in this edition.

The large (more than 300 pages), but somewhat muddled "JavaScript Reference" in the 3rd edition (it had commingled the objects, properties, and methods included in the core of the JavaScript language with those of the Level 0 DOM) has been split into 4 discrete appendices ("Core JavaScript Reference", "Client-Side JavaScript Reference", "W3C DOM Reference", and "Class, Property, Method, and Event Handler Index") that, taken together, comprise more than 400 more pages of information. NS 4.x fans can take comfort from the fact that, while much NS 4.x-specific information has been culled from the body of the text, Netscape 4.x still shows up in some screen captures (along with Microsoft Internet Explorer and Netscape 6).

What was Great

Exception handling (using throw and try/catch/finally) is covered in greater detail. In Chapter 15, "Forms and Form Elements", JavaScript interactions with buttons, toggle buttons (checkbox and radio elements), text fields, hidden elements, and fieldset elements are addressed individually in new sections not present in the corresponding chapter in JS:TDG3 and the section on select and option elements goes into more detail than in the previous edition. Throughout the book, improvements have been made to figures and tables - like the addition of the "Supported by" column in Table 19-1 : "Event handlers and the HTML elements that support them", which now helpfully lists the elements for which the event handlers can be triggered after identifiers for the versions of Netscape and Internet Explorer in which the behavior is observed. Finally, the book as a whole is significantly more readable. The type used for the text of the code examples and tables was too "light" in the 3rd edition (at least in my copy), and I was glad to see that it's a bit heavier in the 4th.

What was Not so Great

I nearly came up empty-handed in my search for defects in this book, but noticed that, in tables 11-1 and 11-3, "Automatic data type conversions" and "Data type manipulation in JavaScript" respectively, information relating to the treatment of arrays and functions present in the corresponding tables in the 3rd edition has been removed. That's really my only gripe. Some might wish that Flanagan had included more compatibility information, but, realistically, the task of fully documenting the intricacies of what's supported by which browser (or, in the case of Win MSIE, which JScript dll is installed) could probably fill a separate book all of its own. Moreover, Chapter 20 ("Compatibility Techniques"), may be brief at only 11 pages, but it does a good job of tackling best practices in dealing with JavaScript and DOM cross-browser compatibility challenges.

To Buy or Not to Buy

If you're in the market for a good JavaScript (or JavaScript+DOM) book, then JavaScript : The Definitive Guide should undoubtedly be your first choice. Although my 3rd edition was so tattered from long use that I really had no choice but to upgrade, even owners of the 3rd edition who've managed to keep their copies in near-mint condition will probably still want to get their hands on the 4th edition if they haven't already done so - for the meatier and updated reference appendices if for no other reason.

Table of Contents

Preface

  • Chapter 1. Introduction to JavaScript

Part I : Core JavaScript

  • Chapter 2. Lexical Structure
  • Chapter 3. Data Types and Values
  • Chapter 4. Variables
  • Chapter 5. Expressions and Operators
  • Chapter 6. Statements
  • Chapter 7. Functions
  • Chapter 8. Objects
  • Chapter 9. Arrays
  • Chapter 10. Pattern Matching with Regular Expressions
  • Chapter 11. Further Topics in JavaScript

Part II : Client-Side JavaScript

  • Chapter 12. JavaScript in Web Browsers
  • Chapter 13. Windows and Frames
  • Chapter 14. The Document Object
  • Chapter 15. Forms and Form Elements
  • Chapter 16. Scripting Cookies
  • Chapter 17. The Document Object Model
  • Chapter 18. Cascading Style Sheets and Dynamic HTML
  • Chapter 19. Events and Event Handling
  • Chapter 20. Compatibility Techniques
  • Chapter 21. JavaScript Security
  • Chapter 22. Using Java with JavaScript

Part III : Core JavaScript Reference

Part IV : Client-Side JavaScript Reference

Part V : W3C DOM Reference

Part VI : Class, Property, Method, and Event Handler Index

Index

You can purchase JavaScript: The Definitive Guide from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

15 of 181 comments (clear)

  1. Use Addall instead... by MajorBurrito · · Score: 3, Informative

    Instead of paying too much to Barnes and Noble, you can get it from AddAll for quite a bit cheaper.

    1. Re:Use Addall instead... by Anonymous Coward · · Score: 1, Informative

      http://www.walmart.com/catalog/product.gsp?cat=186 74&dept=3920&product_id=1612207&path=0%3A3920%3A18 674%3A18691%3A20239

      or walmart. I buy ALL my books from them now. They really *do* have the best prices

  2. Install Mozilla by brunes69 · · Score: 5, Informative

    Edit -> Preferences -> Advanced -> Scripts and Plugins -> Open Unrequested Windows. Uncheck. Done.

    Problem solved.

    1. Re:Install Mozilla by 'The+'.$L3mm1ng · · Score: 2, Informative

      Use the Crazy Browser, it's IE with tabs und PopUp filter.

  3. my opinion (3rd edition) by larry+bagina · · Score: 5, Informative

    I own the third edition of this book, and bought it when I was starting to write a web-based decision support system for a very large beverage company. I can safely say that this book, and the HTML Definitive Guide (also by O'Reilly) were critical to the success of the system.

    I have seldom had a question about JavaScript for which I could not find the answer in this book. I referred to it so frequently during the development of our system that it is now the most dog-eared book in my collection. I'm going to order the fourth edition simply because this baby is ready for retirement.

    If you are learning client-side JavaScript, by all means purchase this book. The first half of the book is a guided introduction to the language and does a wonderful job of explaining the syntax of the language, the underlying object model, and virtually every pertinent feature of the language. The real value, though, is in the reference, which documents every object, method, property and event of standard JavaScript.

    Non-conformists who wish to exploit features unique to Internet Explorer will find some reference material here, but the book does try to focus on the "standard" features of the language, which I think is a good thing.

    You just can't go wrong with this book.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  4. Re:Great. by noda132 · · Score: 2, Informative

    Any decent browser nowadays can block popups while keeping Javascript enabled. Go get Mozilla, Galeon, Opera, Konqueror... the list goes on and on.

    In short: Don't use IE, and you won't get popups. Your browsing experience will also be faster and more intuitive.

  5. Re:Javascript not dead by Pfhreakaz0id · · Score: 4, Informative

    Dead? Heck no... Even most IE-only Intranet projects (like the one I work on) use Javascript as the client-side scripting lagnuage. Why? Almost ALL example code/books on client-side scripting are in Javascript. Heck, it's even the default in MS Visual Interdev (select "insert client side script" and you get a Javascript block).

    Plus, I know an increasingly large number of ASP developers who use Jscript (microsoft's Javascript, they just can't use the name) as the scripting language for the Server-Side ASP code (rather than the VBScript mose use). Why? It just makes more sense. It's annoying to "switch mental gears" when going from the client-side code blocks in Javascript and the server-side VBScript blocks. Also, many are in the boat we're in where we do some Java stuff as well. Syntax is fairly consistent between Java and JavaScript.

  6. Great book.. by Pfhreakaz0id · · Score: 4, Informative

    but it has been out a while. I have an old second edition that is heavily thumbed. I recently inquired and for those that don't know, O'Reily has an upgrade program where for a small fee (I think it was $10 plus shipping, but don't quote me.) you get an upgraded edition. sweet. Look on their website for info.

  7. Re:Strengths of Javascript. by Pfhreakaz0id · · Score: 3, Informative

    agreed. We get guys on my project who immediately want to go to a server side solution on everything (oh, let's do a round-trip to the server every time they pick a new selection! That won't be annoying or anything!). When I suggest we use client-side they say "oh that's too hard". Then I whip up the script and they are amazed. I'd rather write Javascript then a SQL procedure any day of the week!

  8. Can you give some examples? by avdi · · Score: 3, Informative

    I can't think of an O'Reilly book I own which isn't excellent. True, some of them are old classics like "UNIX Power Tools", and "Managing Projects with make". But their most recent books have been just as exemplary - the latest edition of the Camel book simply improves on the earlier editions. The "CVS Pocket Reference" is exactly what I needed for day-to-day CVS work. The latest edition of "Web Designer in a Nutshell" has a permanent spot on my desk now that I have a website.

    So - what titles would you warn against?

    --

    --
    CPAN rules. - Guido van Rossum
    1. Re:Can you give some examples? by bunratty · · Score: 3, Informative
      The editing of O'Reilly books has for some reason suffered over the past few years. The most obvious symptom is that O'Reilly used to correct mistakes with nearly every new printing, about twice a year for an average O'Reilly book. However, now I cannot find a single O'Reilly title that has corrected printings for the last year. For example, compare the printings of JS: TNG3 (10 reprints in 3 years) vs. JS: TNG3 (0 reprints in 9 months). Another example is HTML: The Definitive Guide, 3rd edition (4 reprints in 2 years) vs. HTML: The Definitive Guide, 4th edition (2 reprints in 2 years). Can you find a corrected reprint that has happened within the past year?

      Another disturbing trend is that new books don't contain information that is as up-to-date as before. An obvious example is CSS Pocket Reference. Even though it was published last year, it doesn't cover any of CSS2. For some odd reason, the book was published right before IE6 was released, and so doesn't have any information about what will become the most popular browser in the world this year. And don't expect a corrected printing any time soon!

      It used to be the case that you could count an O'Reilly books having the most accurate and up-to-date information. Nowadays, that isn't true any more.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
  9. congrats, you're an idiot by Anonymous Coward · · Score: 1, Informative

    Javascript has nothing to do with Java. Netscape chose the name to make it popular.

  10. Re:Compatibility Question by twocents · · Score: 2, Informative

    This might be too brief, but:

    For one thing, remember that compatibility is very often not a matter of the JavaScript, but the Document Object Model within the browser that you are trying to manipulate, which implies CSS compatibility. http://www.webreview.com/style/css1/charts/masterg rid.shtml truly reveals how CSS rules can vary.

    And as far as checking differences between browsers, that is simply a matter of checking the version your browser supports against a version of JavaScript (while I have heard that there are different implementations of different versions...but that's an experience thing I think). So you could go to http://www.gemal.dk/browserspy/js.html, check your JS browser support, and then when you reference a book on JavaScript, just take note of what version they are referring to.

    Danny Goodman's books used to really spend a ton of time on compatibility (http://search.barnesandnoble.com/booksearch/isbnI nquiry.asp?userid=52AY8TR23D&isbn=0764533428), at least the 3rd edition had mucho information on NS 4 vs. IE.

    While this response does not give you a chart, I have found, both programming in it and teaching it, that just being aware of supported versions and maybe not always implementing the newest features (which are often just shortcuts to do things one can already program) in JavaScript should keep one out of too much trouble. But man, that CSS stuff is what kills.

    Hope this helps.

  11. Browser compatibility by mooman · · Score: 2, Informative

    Since this is a real issue for anyone that does a fair amount of web development, I thought maybe I should point out a good resource that really supplements any JS book you use..

    The IRT JavaScript FAQ is a surprisingly comprehensive list of FAQ and "how do I..." type questions for JavaScript. I find myself relying very heavily on it for snippets of code.

    Once you've "learned" JavaScript, a site like this is great when you don't want to reinvent the wheel or spend 20 minutes skimming a book trying to figure out why something works in Netscape but not IE...

    --
    In the Portland, Ore area and like card games? Check out: http://groups.yahoo.com/group/portlandgames/
  12. Javascript is not just for browsers anymore! by mmcshane · · Score: 2, Informative

    I too usually surf with Javascript turned off (tip: add the Preferences toolbar to mozilla to be able to toggle js/java/cookies/etc. on and off quickly) but Javascript is gaining ground as a more general purpose language. See a recent article in Javaworld on using Netscape's free Rhino library to add javascriptability to your applications. Also, Javascript is how many XUL mini-apps are implemented.