Object-Oriented JavaScript

This book explores JavaScript for what it is: a highly expressive and flexible prototype-based object-oriented programming language. Once dismissed as a toy for designers to make things such as rollover buttons, today this interesting and unique
language is back, stronger than ever. Today’s Web 2.0 world of AJAX, fat-client programming, desktop-like rich Internet applications, drag-and-drop maps and webmail clients, rely heavily on JavaScript to provide a highly interactive user experience.

More PDF Content

Object-Oriented JavaScript
Create scalable, reusable high-quality JavaScript applications, and libraries

  • Preface
  • Chapter 1: Introduction
  • A Bit of History
  • The Winds of Change
  • The Present
  • The Future
  • Object-Oriented Programming
  • Objects
  • Classes
  • Encapsulation
  • Aggregation
  • Inheritance
  • Polymorphism
  • OOP Summary
  • Setting up Your Training Environment
  • Getting the Tools You Need
  • Using the Firebug Console
  • Summary
  • Chapter 2: Primitive Data Types, Arrays, Loops,
  • and Conditions
  • Variables
  • Variables are Case Sensitive
  • Operators
  • Primitive Data Types
  • Finding out the Value Type —the typeof Operator
  • Numbers
  • Octal and Hexadecimal Numbers
  • Exponent Literals
  • Table of Contents
  • Infinity
  • NaN
  • Strings
  • String Conversions
  • Special Strings
  • Booleans
  • Logical Operators
  • Operator Precedence
  • Lazy Evaluation
  • Comparison
  • Undefined and null
  • Primitive Data Types Recap
  • Arrays
  • Adding/Updating Array Elements
  • Deleting Elements
  • Arrays of arrays
  • Conditions and Loops
  • Code Blocks
  • if Conditions
  • Checking if a Variable Exists
  • Alternative if Syntax
  • Switch
  • Loops
  • While Loops
  • Do-while loops
  • For Loops
  • For-in Loops
  • Comments
  • Summary
  • Exercises
  • Chapter 3: Functions
  • What is a Function?
  • Calling a Function
  • Parameters
  • Pre-defined Functions
  • parseInt()
  • parseFloat()
  • isNaN()
  • isFinite()
  • Encode/Decode URIs
  • eval()
  • A Bonus—the alert() Function
  • Scope of Variables
  • Functions are Data
  • Anonymous Functions
  • Callback Functions
  • Callback Examples
  • Self-invoking Functions
  • Inner (Private) Functions
  • Functions that Return Functions
  • Function, Rewrite Thyself!
  • Closures
  • Scope Chain
  • Lexical Scope
  • Breaking the Chain with a Closure
  • Closure #1
  • Closure #2
  • A Definition and Closure #3
  • Closures in a Loop
  • Getter/Setter
  • Iterator
  • Summary
  • Exercises
  • Chapter 4: Objects
  • From Arrays to Objects
  • Elements, Properties, Methods
  • Hashes, Associative Arrays
  • Accessing Object\’s Properties
  • Calling an Object\’s Methods
  • Altering Properties/Methods
  • Using this Value
  • Constructor Functions
  • The Global Object
  • constructor Property
  • instanceof Operator
  • Functions that Return Objects
  • Passing Objects
  • Comparing Objects
  • Objects in the Firebug Console
  • Built-in Objects
  • Object
  • Array
  • Interesting Array Methods
  • Function
  • Table of Contents
  • Properties of the Function Objects
  • Methods of the Function Objects
  • The arguments Object Revisited
  • Boolean
  • Number
  • String
  • Interesting Methods of the String Objects
  • Math
  • Date
  • Methods to Work with Date Objects
  • RegExp
  • Properties of the RegExp Objects
  • Methods of the RegExp Objects
  • String Methods that Accept Regular Expressions as Parameters
  • search() and match()
  • replace()
  • Replace callbacks
  • split()
  • Passing a String When a regexp is Expected
  • Summary
  • Exercises
  • Chapter 5: Prototype
  • The prototype Property
  • Adding Methods and Properties Using the Prototype
  • Using the Prototype\’s Methods and Properties
  • Own Properties versus prototype Properties
  • Overwriting Prototype\’s Property with Own Property
  • Enumerating Properties
  • isPrototypeOf()
  • The Secret __proto__ Link
  • Augmenting Built-in Objects
  • Augmenting Built-in Objects—Discussion
  • Some Prototype gotchas
  • Summary
  • Exercises
  • Chapter 6: Inheritance
  • Prototype Chaining
  • Prototype Chaining Example
  • Moving Shared Properties to the Prototype
  • Inheriting the Prototype Only
  • A Temporary Constructor—new F()
  • Uber—Access to the Parent from a Child Object
  • Isolating the Inheritance Part into a Function
  • Copying Properties
  • Heads-up When Copying by Reference
  • Objects Inherit from Objects
  • Deep Copy
  • object()
  • Using a Mix of Prototypal Inheritance and Copying Properties
  • Multiple Inheritance
  • Mixins
  • Parasitic Inheritance
  • Borrowing a Constructor
  • Borrow a Constructor and Copy its Prototype
  • Summary
  • Case Study: Drawing Shapes
  • Analysis
  • Implementation
  • Testing
  • Exercises
  • Chapter 7: The Browser Environment
  • Including JavaScript in an HTML Page
  • BOM and DOM—An Overview
  • BOM
  • The window Object Revisited
  • window.navigator
  • Firebug as a Cheat Sheet
  • window.location
  • window.history
  • window.frames
  • window.screen
  • window.open()/close()
  • window.moveTo(), window.resizeTo()
  • window.alert(), window.prompt(), window.confirm()
  • window.setTimeout(), window.setInterval()
  • window.document
  • DOM
  • Core DOM and HTML DOM
  • Accessing DOM Nodes
  • The document Node
  • documentElement
  • Child Nodes
  • Attributes
  • Accessing the Content Inside a Tag
  • DOM Access Shortcuts
  • Table of Contents
  • Siblings, Body, First, and Last Child
  • Walk the DOM
  • Modifying DOM Nodes
  • Modifying Styles
  • Fun with Forms
  • Creating New Nodes
  • DOM-only Method
  • cloneNode()
  • insertBefore()
  • Removing Nodes
  • HTML-Only DOM Objects
  • Primitive Ways to Access the Document
  • document.write()
  • Cookies, Title, Referrer, Domain
  • Events
  • Inline HTML Attributes
  • Element Properties
  • DOM Event Listeners
  • Capturing and Bubbling
  • Stop Propagation
  • Prevent Default Behavior
  • Cross-Browser Event Listeners
  • Types of Events
  • XMLHttpRequest
  • Send the Request
  • Process the Response
  • Creating XMLHttpRequest Objects in IE prior to version 7
  • A is for Asynchronous
  • X is for XML
  • An Example
  • Summary
  • Exercises
  • Chapter 8: Coding and Design Patterns
  • Coding Patterns
  • Separating Behavior
  • Content
  • Presentation
  • Behavior
  • Example of Separating Behavior
  • Namespaces
  • An Object as a Namespace
  • Namespaced Constructors
  • A namespace() Method
  • Init-Time Branching
  • Lazy Definition
  • Configuration Object
  • Private Properties and Methods
  • Privileged Methods
  • Private Functions as Public Methods
  • Self-Executing Functions
  • Chaining
  • JSON
  • Design Patterns
  • Singleton
  • Singleton 2
  • Global Variable
  • Property of the Constructor
  • In a Private Property
  • Factory
  • Decorator
  • Decorating a Christmas Tree
  • Observer
  • Summary
  • Appendix A: Reserved Words
  • Keywords
  • Future Reserved Words
  • Appendix B: Built-in Functions
  • Appendix C: Built-in Objects
  • Object
  • Members of the Object Constructor
  • Members of the Objects Created by the Object Constructor
  • Array
  • Members of the Array Objects
  • Function
  • Members of the Function Objects
  • Boolean
  • Number
  • Members of the Number Constructor
  • Members of the Number Objects
  • String
  • Members of the String Constructor
  • Members of the String Objects
  • Date
  • Members of the Date Constructor
  • Table of Contents
  • Members of the Date Objects
  • Math
  • Members of the Math Object
  • RegExp
  • Members of RegExp Objects
  • Error Objects
  • Members of the Error Objects
  • Appendix D: Regular Expressions
  • Index
Download Object-Oriented JavaScript pdf from www.javascriptworkshop.com, 347 pages, 5757.01KB.
Related Books

Leave a Reply