Preface

There have been many changes in the world of web programming with JavaScript™ since the third edition of this book was published, including:

  • Second and third editions of the ECMA-262 standard have been published, updating the core JavaScript language. Conformant versions of Netscape’s JavaScript interpreter and Microsoft’s JScript interpreter have been released.

  • The source code for Netscape’s JavaScript interpreters (one written in C and one written in Java™) has been released as open source and is available to anyone who wants to embed a scripting language in his application.

  • The World Wide Web Consortium (W3C) has published two versions (or levels) of a Document Object Model (DOM) standard. Recent browsers support this standard (to varying degrees) and allow client-side JavaScript to interact with document content to produce sophisticated Dynamic HTML (DHTML) effects. Support for other W3C standards, such as HTML 4, CSS1, and CSS2, has also become widespread.

  • The Mozilla organization, using source code originally contributed by Netscape, has produced a good fifth-generation browser. At the time of this writing, the Mozilla browser is not yet at the 1.0 release level, but the browser is mature enough that Netscape has based its 6.0 and 6.1 browsers upon the Mozilla code base.

  • Microsoft’s Internet Explorer has become the overwhelmingly dominant browser on desktop systems. However, the Netscape/Mozilla browser remains relevant to web developers, especially because of its superior support for web standards. In addition, minor browsers such as Opera (http://www.opera.com) and Konquerer (http://www.konqueror.org) should be seen as equally relevant.

  • Web browsers (and JavaScript interpreters) are no longer confined to the desktop but have migrated to PDAs and even cell phones.

In summary, the core JavaScript language has matured. It has been standardized and is used in a wider variety of environments than it was previously. The collapse of Netscape’s market share has allowed the universe of desktop web browsers to expand, and JavaScript-enabled web browsers have also become available on non-desktop platforms. There has been a distinct, if not complete, move toward web standards. The (partial) implementation of the DOM standard in recent browsers gives web developers a long-awaited vendor-independent API to which they can code.

What’s New in the Fourth Edition

This edition of JavaScript: The Definitive Guide has been thoroughly updated in light of the changes I just described. Major new features include complete coverage of JavaScript 1.5 and the third edition of the ECMA-262 standard on which it is based, and complete coverage of the Level 2 DOM standard.

Throughout the book, the focus has shifted from documenting particular JavaScript and browser implementations ( JavaScript 1.2, Netscape 4, Internet Explorer 5, etc.) to documenting the standards upon which those implementations are (or ought to be) based. Because of the proliferation of implementations, it is no longer practical for any one book to attempt to document -- or for any one developer to attempt to understand -- every feature, proprietary extension, quirk, and bug of every implementation. Focusing on the specifications instead of the implementations makes this book easier to use and, if you take the same approach, will make your JavaScript code more portable and maintainable. You’ll particularly notice the increased emphasis on standards in the new material on core JavaScript and the DOM.

Another major change in this edition is that the reference section has been split into three distinct parts. First, the core JavaScript material has been separated from the client-side JavaScript material (Part IV) and placed in a section of its own (Part III). This division is for the convenience of JavaScript programmers who are working with the language in an environment other than a web browser and who are not interested in client-side JavaScript.

Second, the new material documenting the W3C DOM has been placed in a section of its own (Part V), separate from the existing client-side JavaScript material. The DOM standard defines an API that is quite distinct from the “legacy” API of traditional client-side JavaScript. Depending on the browser platforms they are targeting, developers typically use one API or the other and usually do not need to switch back and forth. Keeping these two APIs distinct also preserves the organization of the existing client-side reference material, which is convenient for readers of the third edition who upgrade to this edition.

In order to accommodate all the new material without making the book much, much larger, I’ve gotten rid of reference pages for the trivial properties of objects. These properties are already described once on the reference page for the object, and putting another description in a reference page of its own was redundant and wasteful. Properties that require substantial description, as well as all methods, still have reference pages of their own. Furthermore, the design wizards at O’Reilly have created a new interior design for the book that remains easy and pleasant to read but takes up less space.

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.