Skip to main content

Professional JavaScript for Web Developers, 3rd Edition

Professional JavaScript for Web Developers, 3rd Edition

Nicholas C. Zakas

ISBN: 978-1-118-23309-2

Dec 2011

960 pages

$29.99

Description

This book provides a developer-level introduction along with more advanced and useful features of JavaScript. Coverage includes:

  • JavaScript use with HTML to create dynamic webpages, language concepts including syntax and flow control statements
  • variable handling given their loosely typed nature
  • built-in reference types such as object and array
  • object-oriented programing
  • powerful aspects of function expressions
  • Browser Object Model allowing interaction with the browser itself
  • detecting the client and its capabilities
  • Document Object Model (DOM) objects available in DOM Level 1
  • how DOM Levels 2 and 3 augmented the DOM
  • events, legacy support, and how the DOM redefined how events should work
  • enhancing form interactions and working around browser limitations
  • using the <canvas > tag to create on-the-fly graphics
  • JavaScript API changes in HTML5
  • how browsers handle JavaScript errors and error handling
  • features of JavaScript used to read and manipulate XML data
  • the JSON data format as an alternative to XML
  • Ajax techniques including the use of XMLHttpRequest object and CORS
  • complex patterns including function currying, partial function application, and dynamic functions
  • offline detection and storing data on the client machine
  • techniques for JavaScript in an enterprise environment for better maintainability

This book is aimed at three groups of readers: Experienced object-oriented programming developers looking to learn JavaScript as it relates to traditional OO languages such as Java and C++; Web application developers attempting to enhance site usability; novice JavaScript developers.

Nicholas C. Zakas worked with the Web for over a decade. He has worked on corporate intranet applications used by some of the largest companies in the world and large-scale consumer websites such as MyYahoo! and the Yahoo! homepage. He regularly gives talks at companies and conferences regarding front-end best practices and new technology.

Related Resources

Instructor

Request an Evaluation Copy for this title

FOREWORD xxxi

INTRODUCTION xxxiii

CHAPTER 1: WHAT IS JAVASCRIPT? 1

CHAPTER 2: JAVASCRIPT IN HTML 13

CHAPTER 3: LANGUAGE BASICS 25

CHAPTER 4: VARIABLES, SCOPE, AND MEMORY 85

CHAPTER 5: REFERENCE TYPES 103

CHAPTER 6: OBJECT-ORIENTED PROGRAMMING 173

CHAPTER 7: FUNCTION EXPRESSIONS 217

CHAPTER 8: THE BROWSER OBJECT MODEL 239

CHAPTER 9: CLIENT DETECTION 271

CHAPTER 10: THE DOCUMENT OBJECT MODEL 309

CHAPTER 11: DOM EXTENSIONS 357

CHAPTER 12: DOM LEVELS 2 AND 3 381

CHAPTER 13: EVENTS 431

CHAPTER 14: SCRIPTING FORMS 511

CHAPTER 15: GRAPHICS WITH CANVAS 551

CHAPTER 16: HTML5 SCRIPTING 591

CHAPTER 17: ERROR HANDLING AND DEBUGGING 607

CHAPTER 18: XML IN JAVASCRIPT 641

CHAPTER 19: ECMASCRIPT FOR XML 671

CHAPTER 20: JSON 691

CHAPTER 21: AJAX AND COMET 701

CHAPTER 22: ADVANCED TECHNIQUES 731

CHAPTER 23: OFFLINE APPLICATIONS AND CLIENT-SIDE STORAGE 765

CHAPTER 24: BEST PRACTICES 801

CHAPTER 25: EMERGING APIS 835

APPENDIX A: ECMASCRIPT HARMONY 857

APPENDIX B: STRICT MODE 877

APPENDIX C: JAVASCRIPT LIBRARIES 885

APPENDIX D: JAVASCRIPT TOOLS 891

INDEX 897

Full Code Download
Download
ReadMe File
Download
Chapter 3
Download
Chapter 4
Download
Chapter 5
Download
Chapter 6
Download
Chapter 7
Download
Chapter 8
Download
Chapter 9
Download
Chapter 10
Download
Chapter 11
Download
Chapter 12
Download
Chapter 13
Download
Chapter 14
Download
Chapter 15
Download
Chapter 16
Download
Chapter 17
Download
Chapter 18
Download
Chapter 19
Download
Chapter 20
Download
Chapter 21
Download
Chapter 22
Download
Chapter 23
Download
Chapter 24
Download
Chapter 25
Download
ChapterPageDetailsDatePrint Run
37Error in Text,On page 37, the section entitled NaN , the last two sentences of the first paragraph(begins with For example ) should be replaced with:

For example, attempting to divide a number by a non-number typically causes an error in other languages, halting execution. In ECMAScript, dividing a number by a non-number returns NaN, which allows other processing to continue.
09/02/2013
40Error in Code,The following code currently reads:

 //56 (octal) in ECMAScript 3, 0 (decimal) in ECMAScript 5 var num = parseInt(�070�); 


It should read:

 //56 (octal) in ECMAScript 3, 70 (decimal) in ECMAScript 5 var num = parseInt(�070�); 
12/12/12
40Error in Description of Code,Currently reads:
In ECMAScript 5 JavaScript engines, the ability to parse octal values has been removed from parseInt(), so the leading zero is considered invalid and the value is treated the same as �0�, resulting in the decimal value 0.

Should read:
In ECMAScript 5 JavaScript engines, the ability to parse octal values has been removed from parseInt(), so the leading zero is ignored and the value is treated the same as �70�, resulting in the decimal value 70.
12/12/12
82Error in Text,The following sentence should be removed:

This effect goes only one way: changing the named argument does not result in a change to the corresponding value in arguments.

This is no longer true.
12/12/12
92Error in Text,Currently reads:
Neither the global context nor the local context of swapColors() has access to tempColor.

Should be:
Neither the global context nor the local context of changeColor() has access to tempColor.
12/5/2012
108Error in Text,Currently reads: ArrayFilterExample03.htm

Should read: ArrayTypeExample03.htm.
01/02/2014
109Error in Text,Currently reads: ArrayFilterExample04-06.htm

Should read: ArrayTypeExample04-06.htm
01/02/2014
110Error in Text,Currently reads: ArrayFilterExample07.htm

Should read: ArrayTypeExample07.htm
01/02/2014
114Error in Code,Currently reads: //get the first item

Should read: //get the first last item


The same change should be made in ArrayTypeExample12.htm.
01/02/2014
122Error in Text,This sentence:

Using this data storage format, the Date type can accurately represent dates 285,616 years before or after January 1, 1970.

Should read:

Using this data storage format, the Date type can accurately represent dates 100,000,000 days before or after January 1, 1970.
12/12/12
133Error in Code,In this code snippet:
 var matches = pattern2.exec(text); console.log(matches.index); //0 console.log(matches[0]); //cat console.log(pattern2.lastIndex); //0 

The last line should be changed to:
 console.log(pattern2.lastIndex); // 3 
03/06/2013
746Error in Text,2nd paragraph currently reads:

There is also an Object.isFrozen() method to detect frozen objects. Since frozen objects are both sealed and extensible...

Should read:

.... Since frozen objects are both sealed and not extensible...
11/11/2013
840Error in Code,The function definition for isHiddenSupport (th