You are previewing Pro JavaScript Techniques, Second Edition.
O'Reilly logo
Pro JavaScript Techniques, Second Edition

Book Description

Pro JavaScript Techniques is the ultimate JavaScript book for today's web developer. It provides everything you need to know about modern JavaScript, and teaches you what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, but instead concentrates on fundamental, vital topics—what modern JavaScripting is (and isn't), and pitfalls to be wary of.

You will learn about the 'this' keyword, as well as new object tools. You will be able to create reusable code with encapsulation, overloading and inheritance. The most recent techniques for debugging and testing are covered comprehensively, with information on Chrome developer tools, Jasmine, PhantomJS and Protractor. This update finishes with chapters on constructing single-page web applications that dominate the modern web.

The book is filled with real-world examples and case studies, as well as numerous reusable functions and classes to save you time in your development. You will learn the practical skills needed to build professional, dynamic web applications. Pro JavaScript Techniques is an indispensable reference for any professional JavaScript web developer—enhance your JavaScript development today.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Authors
  8. About the Technical Reviewers
  9. Acknowledgments
  10. Chapter 1: Professional JavaScript Techniques
    1. How Did We Get Here?
    2. Modern JavaScript
      1. The Rise of Libraries
      2. More Than a Note about Mobile
      3. Where Do We Go from Here?
    3. Coming Up Next
    4. Summary
  11. Chapter 2: Features, Functions, and Objects
    1. Language Features
      1. References and Values
      2. Scope
      3. Context
      4. Closures
      5. Function Overloading and Type-Checking
    2. New Object Tools
      1. Objects
      2. Modifying Objects
    3. Summary
  12. Chapter 3: Creating Reusable Code
    1. Object-Oriented JavaScript
      1. Inheritance
      2. Member Visibility
      3. The Future of Object-Oriented JavaScript
    2. Packaging JavaScript
      1. Namespaces
      2. The Module Pattern
      3. Immediately Invoked Function Expressions
    3. Summary
  13. Chapter 4: Debugging JavaScript Code
    1. Debugging Tools
      1. The Console
      2. Leveraging the Console Features
    2. The Debugger
      1. DOM Inspector
      2. Network Analyzer
      3. Timeline
      4. Profiler
    3. Summary
  14. Chapter 5: The Document Object Model
    1. An Introduction to the Document Object Model
      1. DOM Structure
      2. DOM Relationships
    2. Accessing DOM Elements
      1. Finding Elements by CSS Selector
    3. Waiting for the HTML DOM to Load
      1. Waiting for the Page to Load
      2. Waiting for the Right Event
    4. Getting the Contents of an Element
      1. Getting the Text of an Element
      2. Getting the HTML of an Element
    5. Working with Element Attributes
      1. Getting and Setting an Attribute Value
    6. Modifying the DOM
      1. Creating Nodes Using the DOM
      2. Inserting into the DOM
      3. Injecting HTML into the DOM
      4. Removing Nodes from the DOM
      5. Handling White Space in the DOM
      6. Simple DOM Navigation
    7. Summary
  15. Chapter 6: Events
    1. Introduction to JavaScript Events
      1. The Stack, the Queue, and the Event Loop
      2. Event Phases
    2. Binding Event Listeners
      1. Traditional Binding
      2. DOM Binding: W3C
      3. Unbinding Events
    3. Common Event Features
      1. The Event Object
      2. Canceling Event Bubbling
      3. Overriding the Browser’s Default Action
      4. Event Delegation
    4. The Event Object
      1. General Properties
      2. Mouse Properties
      3. Keyboard Properties
    5. Types of Events
      1. Page Events
      2. UI Events
      3. Mouse Events
      4. Keyboard Events
      5. Form Events
      6. Event Accessibility
    6. Summary
  16. Chapter 7: JavaScript and Form Validation
    1. HTML and CSS Form Validation
      1. CSS
    2. JavaScript Form Validation
      1. Validation and Users
      2. Validation Events
    3. Customizing Validation
      1. Preventing Form Validation
    4. Summary
  17. Chapter 8: Introduction to Ajax
    1. Using Ajax
      1. HTTP Requests
      2. HTTP Response
    2. Summary
  18. Chapter 9: Web Production Tools
    1. Scaffolding Your Projects
    2. NPM is the Foundation for Everything
    3. Generators
      1. Version Control
      2. Adding Files, Updates, and the First Commit
    4. Summary
  19. Chapter 10: AngularJS and Testing
    1. Views and Controllers
    2. Remote Data Sources
    3. Routes
    4. Route Parameters
    5. Application Testing
      1. Unit Testing
      2. End to End Testing with Protractor
    6. Summary
  20. Chapter 11: The Future of JavaScript
    1. The Once and Future ECMAScript
    2. Using ECMAScript Harmony
      1. Harmony Resources
      2. Working with Harmony
    3. ECMAScript Harmony Language Features
      1. Arrow Functions
      2. Classes
      3. Promises
      4. Modules
      5. Type Extensions
      6. New Collection Types
    4. Summary
  21. Appendix A: DOM Reference
    1. Resources
    2. Terminology
    3. Global Variables
      1. document
      2. HTMLElement
    4. DOM Navigation
      1. body
      2. childNodes
      3. documentElement
      4. firstChild
      5. getElementById( elemID )
      6. getElementsByTagName( tagName )
      7. lastChild
      8. nextSibling
      9. parentNode
      10. previousSibling
    5. Node Information
      1. innerText
      2. nodeName
      3. nodeType
      4. nodeValue
    6. Attributes
      1. className
      2. getAttribute( attrName )
      3. removeAttribute( attrName )
      4. setAttribute( attrName, attrValue )
    7. DOM Modification
      1. appendChild( nodeToAppend )
      2. cloneNode( true|false )
      3. createElement( tagName )
      4. createElementNS( namespace, tagName )
      5. createTextNode( textString )
      6. innerHTML
      7. insertBefore( nodeToInsert, nodeToInsertBefore )
      8. removeChild( nodeToRemove )
      9. replaceChild( nodeToInsert, nodeToReplace )
  22. Index