Download E-book : Learning from jQuery
Download E-book : Learning from jQuery / PDF
1. Event Handling.
Listening for Events 1
Events in jQuery 1
Events in JavaScript 2
Events in Internet Explorer 8 2
Writing a Wrapper Function 3
Adding Event Handlers to Multiple Elements 5
Event Propagation 7
Internet Explorer’s .attachEvent 10
Triggering Events 11
Triggering Events in Internet Explorer 8 13
Writing a Wrapper Function to Trigger Events 13
Removing Event Handlers 14
Removing Event Handlers in Internet Explorer 8 15
Writing a Wrapper Function to Remove Events 15
Adding a “Once Only” Event Listener 16
2. Constructors and Prototypes
Constructors 19
Method Chaining 20
Constructor, Not Function 21
Prototypes 22
.hasOwnProperty 24
Editing the Prototype of Existing Objects 24
Summary 25
3. DOM Traversal and Manipulation
Selecting an Element 27
Selecting Elements with a CSS Selector 28
Selecting Children 29
Selecting the Next Element 30
Creating an Element 31
Modifying an Existing Element 31
Cycling Through Elements 33
Moving and Copying Elements 33
4. AJAX.
Sending an AJAX Request 35
Debugging 36
Debugging Sent AJAX Requests 37
Sending POST Requests in JavaScript 37
Writing a Wrapper Function 38
A Simple Application of AJAX 39
Designing a Site with AJAX 41
5. JavaScript Conventions.
Writing JavaScript 43
Comments 43
Coding Standards 46
Literals Notation 50
Object Literals 50
Other Literals 51
Optimizations 51
Algorithms 52
Caching Variables 52
parseInt 53
Loops 53
Minimize Repeated Expressions 54
Functions 54
Declarations Versus Expressions 54
Function Callbacks 55
If Invoking Self-Defining Functions 56
Code Reuse 58
Common Antipatterns 58
Using eval 59
with 59
document.write
Common Design Patterns 60
The Singleton Pattern 61
The Factory Pattern 62
The Iterator Pattern 63
The Facade Pattern 64
Download E-book : Learning from jQuery / PDF
0 commentaires: