Synopses & Reviews
Professional JavaScript for Web Developers, 2nd Edition, provides a developer-level introduction along with the more advanced and useful features of JavaScript.
Starting at the beginning, the book explores how JavaScript originated and evolved into what it is today. A detailed discussion of the components that make up a JavaScript implementation follows, with specific focus on standards such as ECMAScript and the Document Object Model (DOM). The differences in JavaScript implementations used in different popular web browsers are also discussed.
Building on that base, the book moves on to cover basic concepts of JavaScript including its version of object-oriented programming, inheritance, and its use in various markup languages such as HTML. An in-depth examination of events and event handling is followed by an exploration of browser detection techniques and a guide to using regular expressions in JavaScript. The book then takes all this knowledge and applies it to creating dynamic user interfaces.
The last part of the book is focused on advanced topics, including performance/memory optimization, best practices, and a look at where JavaScript is going in the future.
This book is aimed at three groups of readers:
- Experienced developers familiar with object-oriented programming who are looking to learn JavaScript as it relates to traditional OO languages such as Java and C++
- Web application developers attempting to enhance the usability of their web sites and web applications
- Novice JavaScript developers aiming to better understand the language
In addition, familiarity with the following related technologies is a strong indicator that this book is for you:
This book is not aimed at beginners who lack a basic computer science background or those looking to add some simple user interactions to web sites. These readers should instead refer to Wrox’s Beginning JavaScript, 3rd Edition (Wiley, 2007).
This book covers:
- What Is JavaScript?—Explains the origins of JavaScript: where it came from, how it evolved, and what it is today. Concepts introduced include the relationship between JavaScript and ECMAScript, the Document Object Model (DOM), and the Browser Object Model (BOM). A discussion of the relevant standards from the European Computer Manufacturer’s Association (ECMA) and the World Wide Web Consortium (W3C) is also included.
- JavaScript in HTML—Examines how JavaScript is used in conjunction with HTML to create dynamic web pages. Introduces the various ways of embedding JavaScript into a page, including a discussion surrounding the JavaScript content-type and its relationship to the element.
- Language Basics—Introduces basic language concepts, including syntax and flow control statements. Explains the syntactic similarities of JavaScript and other C-based languages and points out the differences. Type coercion is introduced as it relates to built-in operators.
- Variables, Scope, and Memory—Explores how variables are handled in JavaScript given their loosely typed nature. A discussion about the differences between primitive and reference values is included, as is information about execution context as it relates to variables. Also, a discussion about garbage collection in JavaScript explains how memory is reclaimed when variables go out of scope.
- Reference Types—Covers all of the details regarding JavaScript's built-in reference types, such as Object and Array. Each reference type described in ECMA-262 is discussed both in theory and how they relate to browser implementations.
- Object-Oriented Programming—Explains how to use object-oriented programming in JavaScript. Since JavaScript has no concept of classes, several popular techniques are explored for object creation and inheritance. Also covered is the concept of function prototypes and how that relates to an overall OO approach.
- Anonymous Functions—Explores one of the most powerful aspects of JavaScript: anonymous functions. Topics include closures, how the this object works, the module pattern, and creating private object members.
- The Browser Object Model—Introduces the Browser Object Model (BOM), which is responsible for objects allowing interaction with the browser itself. Each of the BOM objects is covered, including window, document, location, navigator, and screen.
- Client Detection—Explains various approaches to detecting the client machine and its capabilities. Different techniques include capability detection and user-agent string detection. Each approach is discussed for pros and cons as well as situational appropriateness.
- The Document Object Model—Introduces the Document Object Model (DOM) objects available in JavaScript as defined in DOM Level 1. A brief introduction to XML and its relationship to the DOM gives way to an in-depth exploration of the entire DOM and how it allows developers to manipulate a page.
- DOM Levels 2 and 3 Explains how DOM Levels 2 and 3 augmented the DOM with additional properties, methods, and objects. Compatibility issues between Internet Explorer and other browsers are discussed.
- Events—Explains the nature of events in JavaScript, where they originated, legacy support, and how the DOM redefined how events should work. A variety of devices are covered, including the Wii and iPhone.
- Scripting Forms—Looks at using JavaScript to enhance form interactions and work around browser limitations. Discussion focuses on individual form elements such as text boxes and select boxes and on data validation and manipulation.
- Error Handling and Debugging—Discusses how browsers handle errors in JavaScript code and presents several ways to handle errors. Debugging tools and techniques are also discussed for each browser, including recommendations for simplifying the debugging process.
- XML in JavaScript—Presents the features of JavaScript used to read and manipulate eXtensible Markup Language (XML) data. Explains the differences in support and objects in various web browsers, and offers suggestions for easier cross-browser coding. This also covers the use of eXtensible Stylesheet Language Transformations (XSLT) to transform XML data on the client.
- ECMAScript for XML—Discusses the ECMAScript for XML (E4X) extension to JavaScript, which is designed to simplify working with XML. Explains the advantages of E4X over using the DOM for XML manipulation.
- Ajax and JSON—Looks at common Ajax techniques, including the use of the XMLHttpRequest object and Internet Explorer's XDomainRequest object for cross-domain Ajax. Explains the differences in browser implementations and support as well as recommendations for usage.
- Advanced Techniques—Dives into some of the more complex JavaScript patterns, including function currying, partial function application, and dynamic functions. Also covers creating a custom event framework to enable simple event support for custom objects.
- Client-Side Storage—Discusses the various techniques for storing data on the client machine. Begins with a discussion of the most commonly supported feature, cookies, and then discusses newer functionality such as DOM storage.
- Best Practices—Explores approaches to working with JavaScript in an enterprise environment. Techniques for better maintainability are discussed, including coding techniques, formatting, and general programming practices. Execution performance is discussed and several techniques for speed optimization are introduced. Last, deployment issues are discussed, including how to create a build process.
- Upcoming APIs—Introduces APIs being created to augment JavaScript in the browser. Even though these APIs aren't yet complete or fully implemented, they are on the horizon and browsers have already begun partially implementing their features. Includes the Selectors API and HTML 5.
- The Evolution of JavaScript—Looks into the future of JavaScript to see where the language is headed. ECMAScript 3.1, ECMAScript 4, and ECMAScript Harmony are discussed.
Synopsis
The first edition of Professional JavaScript was the first time that JavaScript was treated as a firstrate programming language and discussed as such. In the past three years since the book was first released, there have been several advances in the techniques and technology of JavaScript in the browser. This second edition updates the first edition to include the latest versions of all web browsers as well as introducing newer techniques and related technologies such as canvas, E4X, and JavaScript 2.0.
The book sets the stage by covering JavaScript in HTML then explores the core of JavaScript, ECMAScript, to give the reader and understanding of the language's basic syntax, data types, statements, and memory management. Readers will learn about object-oriented programming in JavaScript, including defining their own objects and implementing JavaScript's innovative form of inheritance. The book discusses the Document Object Model (DOM) and the Browser Object Model, explaining how these can be used to alter the user's experience. All three levels of the Document Object Model are explained, including advanced topics such as event simulation, XML parsing, and Xpath queries. The book intermixes with this discussions about XML and XSLT. The last section of the book covers error handling and debugging, design patterns, and best practices for a variety of topics including performance and security.
Retaining and updating much of the coverage from the first edition, some of the new coverage tin he 2nd edition includes:
* Debugging tools in Microsoft Visual Studio, FireBug, and Drosera
* A new chapter on ECMAScript for XML
* A new chapter on client-side data storage with cookies, the DOM, and Flash
* A new chapter on client-side graphics with JavaScript including SVG, VML, and Canvas
* A new chapter on design patterns including creational, structural, and behavioral patterns
* A new advanced techniques chapter covering dynamic functions, currying, array chunking, and anonymous functions
* A new best practices chapter covering maintainability, performance, and deployment practices
* A new appendix introducing key JavaScript libraries including the Yahoo! User Interface Library (YUI), Dojo toolkit, Prototype and Scriptaculous, jQuery, and MooTools
* A new appendix pointing to the changes in JavaScript 2.0
Synopsis
This eagerly anticipated update to the breakout book on JavaScript offers you an in-depth look at the numerous advances to the techniques and technology of the JavaScript language. You'll see why JavaScript's popularity continues to grow while you delve through topics such as debugging tools in Microsoft Visual Studio, FireBug, and Drosera; client-side data storage with cookies, DOM storage, and client-side databases; HTML 5, ECMAScript 3.1, the Selectors API; and design patterns including creational, structural, and behavorial patterns.
Synopsis
This eagerly anticipated update to the breakout book on JavaScript offers you an in-depth look at the numerous advances to the techniques and technology of the JavaScript language. You’ll see why JavaScript’s popularity continues to grow while you delve through topics such as debugging tools in Microsoft Visual Studio, FireBug, and Drosera; client-side data storage with cookies, the DOM, and Flash; client-side graphics with JavaScript including SVG, VML, and Canvas; and design patterns including creational, structural, and behavorial patterns.
Synopsis
If you want to achieve JavaScript's full potential, it is critical to understand its nature, history, and limitations. This book sets the stage by covering JavaScript from its very beginning to the present-day incarnations that include support for the DOM and Ajax. It also shows you how to extend this powerful language to meet specific needs and create seamless client-server communication without intermediaries such as Java or hidden frames.
You'll explore basic concepts of JavaScript including its version of object-oriented programming, inheritance, and its use in HTML and XHTML. A detailed discussion of the components that make up a JavaScript implementation follows, with specific focus on standards such as ECMAScript and DOM. All three levels of DOM are explained, including advanced topics such as event simulation, XML parsing, and XPath queries. You'll also learn how to utilize regular expressions and build dynamic user interfaces. This valuable insight will help you apply JavaScript solutions to the business problems faced by Web developers everywhere.
What you will learn from this book
All of the details regarding JavaScript's built-in reference types
How to use object-oriented programming in JavaScript
Ways to detect the client machine and its capabilities
Debugging tools and techniques for each browser
Steps for reading and manipulating XML data
How to create a custom event framework
Various techniques for storing data on the client machine
Approaches to working with JavaScript in an enterprise environment
Who this book is for
This book is for Web developers who want to use JavaScript to dramatically improve the usability of their Web sites and Web applications and for those with programming experience, especially object-oriented programming experience.
Wrox Professional guides are planned and written by working programmers to meet the real-world needs of programmers, developers, and IT professionals. Focused and relevant, they address the issues technology professionals face every day. They provide examples, practical solutions, and expert education in new technologies, all designed to help programmers do a better job.
Synopsis
Three years after the first edition of this book was released, there have been several advances in the techniques and technology of JavaScript in the browser. This Second Edition has been thoroughly updated to include the latest versions of all web browsers. The book also introduces newer techniques and related technologies such as canvas, E4X, and JavaScript 2.0. Setting the stage by covering JavaScript in HTML, the book then explores the core of JavaScript, ECMAScript, to give you an understanding of the language's basic syntax, data types, statements, and memory management.
About the Author
Nicholas C. Zakas has a B.S. in Computer Science from Merrimack College and an M.B.A. from Endicott College. He is the coauthor of Professional Ajax, Second Edition (Wiley, 2007) as well as dozens of online articles. Nicholas works for Yahoo! as a principal front-end engineer on Yahoo!’s front page and a contributor to the Yahoo! User Interface (YUI) Library. He has worked in web development for more than eight years, during which time he has helped develop web solutions in use at some of the largest companies in the world. Nicholas can be reached through his web site www.nczonline.net.PM
Table of Contents
1. What Is JavaScript?
2. JavaScript in HTML.
3. Language Basics.
4. Variables, Scope, and Memory.
5. Reference Types.
6. Object-Oriented Programming.
7. Anonymous Functions.
8. The Browser Object Model.
9. Client Detection.
10. The Document Object Model.
11. DOM Levels 2 and 3.
12. Events.
13. Scripting Forms.
14. Error Handling and Debugging.
15. XML in JavaScript.
16. ECMAScript for XML.
17. Ajax and JSON.
18. Advanced Techniques.
19. Client-Side Storage.
20. Best Practices.
21. Upcoming APIs.
22. The Evolution of JavaScript.
Appendix A. JavaScript Libraries.
Appendix B. JavaScript Tools.