Anda di halaman 1dari 8

Introduction....................................................................

................................................................................
............................................1
Framework Style.................................................................
................................................................................
.........................1
High Level Framework Structure..................................................
................................................................................
.......1
Helper Methods..................................................................
................................................................................
..................2
Initialisation..................................................................
................................................................................
........................2
Modules and Plugins.............................................................
................................................................................
...............3
Let s Get Coding....................................................................
................................................................................
..............3
Object Oriented JavaScript......................................................
................................................................................
.................................5
Introduction....................................................................
................................................................................
..............................5
Objects and Classes vs. Prototype Classes.......................................
................................................................................
....5
Prototype Classes...............................................................
................................................................................
..................5
Prototypal Inheritance..........................................................
................................................................................
................6
Prototypal vs. Classical........................................................
................................................................................
................6
A Class Model Implementation Design.............................................
................................................................................
..6
Extend..........................................................................
................................................................................
.........................7
Class Creation..................................................................
................................................................................
.....................7
Classes in More Depth...........................................................
................................................................................
......................7
Syntax Sugar * Extend === Mixin.................................................
................................................................................
......8
Super...........................................................................
................................................................................
..........................8
Conclusion......................................................................
................................................................................
............................10

Functional Programming..........................................................
................................................................................
...............................11
Iterators.......................................................................
................................................................................
................................11
Benchmarks......................................................................
................................................................................
..........................12
API Design......................................................................
................................................................................
...........................12
Tests...........................................................................
................................................................................
.................................13
Functional Methods..............................................................
................................................................................
......................13
Filter..........................................................................
................................................................................
.........................13
Detect..........................................................................
................................................................................
........................14
Chaining........................................................................
................................................................................
.............................14
Conclusion......................................................................
................................................................................
....................15
Selector and Selector Engines...................................................
................................................................................
..............................16
Introduction....................................................................
................................................................................
............................16
History.........................................................................
................................................................................
.......................16
Browser Support.................................................................
................................................................................
................16
Performance.....................................................................
................................................................................
...................17
Other Selector Engines..........................................................
................................................................................
.............17
API Design......................................................................
................................................................................
...................17
Goals...........................................................................
................................................................................
........................18
CSS Selectors...................................................................
................................................................................
..........................18
Parsing and Searching Strategy..................................................
................................................................................
........18

Tokenizer.......................................................................
................................................................................
.....................19
Scanner.........................................................................
................................................................................
......................19
Processing the Giant Regular Expression.........................................
................................................................................
.20
Searcher........................................................................
................................................................................
......................21
Implementing the API............................................................
................................................................................
....................23
Tests...........................................................................
................................................................................
.................................23
onReady.........................................................................
................................................................................
.............................23
Our API.........................................................................
................................................................................
.....................25
Implementing onready ..................................................................
................................................................................
..25
Conclusion......................................................................
................................................................................
............................26
Events..........................................................................
................................................................................
..............................................27
Introduction....................................................................
................................................................................
............................27
Basics..........................................................................
................................................................................
........................27
Accessing the Event.............................................................
................................................................................
..............27
Stopping Events.................................................................
................................................................................
.................27
Multiple Handlers...............................................................
................................................................................
................28
Events
Framework APIs..................................................................
................................................................................
...............28
Goals...........................................................................
................................................................................
........................30
W3C and Microsoft...............................................................
................................................................................
.....................30
W3C Event Handling..............................................................

................................................................................
...........30
Microsoft.......................................................................
................................................................................
.....................30
Capabilities and Callbacks......................................................
................................................................................
...................31
Valid Elements..................................................................
................................................................................
.........................31
API Design......................................................................
................................................................................
...........................32
Tests...........................................................................
................................................................................
.................................32
Stopping Events.................................................................
................................................................................
.........................32
Our Stop API....................................................................
................................................................................
..................33
The Implementation..............................................................
................................................................................
.............33
Other Browser Fixes.............................................................
................................................................................
......................33
Event Delegation................................................................
................................................................................
........................34
In the Wild.....................................................................
................................................................................
.....................35
Underneath......................................................................
................................................................................
...................35
dom.findElement.................................................................
................................................................................
...............36
Tests...........................................................................
................................................................................
.........................36
Adapting the Searcher Class.....................................................
................................................................................
..........37
The Event Delegation Method.....................................................
................................................................................
......37
NodeList, Collections and Arrays................................................
................................................................................
..............38
NodeList and Collections........................................................
................................................................................
...........38
Converting NodeList into an Array...............................................
................................................................................
.....39
In the Wild.....................................................................

................................................................................
.....................39
Implementation..................................................................
................................................................................
.................39
References......................................................................
................................................................................
............................39
Ajax............................................................................
................................................................................
................................................41
XMLHttpRequest..................................................................
................................................................................
.....................41
History.........................................................................
................................................................................
.......................41
Request Objects.................................................................
................................................................................
.................41
Sending Requests................................................................
................................................................................
...............42
Popular APIs....................................................................
................................................................................
...................43
Putting it Together.............................................................
................................................................................
.................44
Cross-Domain Requests...........................................................
................................................................................
..................44
Implementations in the Wild.....................................................
................................................................................
.........44
The Algorithm...................................................................
................................................................................
.................44
API Design......................................................................
................................................................................
...................44
Implementation..................................................................
................................................................................
.................45
Conclusion......................................................................
................................................................................
....................45
References......................................................................
................................................................................
............................45
Animations......................................................................
................................................................................
..........................................46
JavaScript Animation............................................................
................................................................................
.....................46
Animation Frameworks............................................................
................................................................................
..........46
Queues and Events...............................................................

................................................................................
..............47
Animation Basics................................................................
................................................................................
...............47
Time-Based Animation............................................................
................................................................................
..................47
Animating Properties............................................................
................................................................................
..............48
Parsing Style Values............................................................
................................................................................
...............48
API.............................................................................
................................................................................
.........................49
Easing..........................................................................
................................................................................
...............................49
Adding Easing Function Support..................................................
................................................................................
.....49
Writing Easing Functions........................................................
................................................................................
...........50
Animation Helpers...............................................................
................................................................................
......................50
Fade............................................................................
................................................................................
........................51
Colour Support..................................................................
................................................................................
.........................52
Channel Surfing.................................................................
................................................................................
.................53
Transformations.................................................................
................................................................................
.................54
Animations
Highlight Helper................................................................
................................................................................
.................54
Conclusion......................................................................
................................................................................
....................55
Movement Helper.................................................................
................................................................................
......................55
Chained API.....................................................................
................................................................................
..........................55
Putting it Together.............................................................
................................................................................
.................56
CSS3............................................................................
................................................................................

...............................57
CSS3 Transitions................................................................
................................................................................
................57
CSS3 Transforms.................................................................
................................................................................
..............57
CSS3 Animations.................................................................
................................................................................
..............58
Animation Performance Problems..................................................
................................................................................
...58
Hardware Acceleration...........................................................
................................................................................
............58
Feature Detection...............................................................
................................................................................
........................59
Move Animation Implementation...................................................
................................................................................
...60
Detecting when a CSS Property Means Move........................................
...........................................................................60
References......................................................................
................................................................................
............................61
Touch...........................................................................
................................................................................
..............................................62
Supporting Touchscreen Devices..................................................
................................................................................
.............62
A Simple Example: Orientation...................................................
................................................................................
......62
Debugging.......................................................................
................................................................................
...................62
Orientation Property............................................................
................................................................................
...............63
Events..........................................................................
................................................................................
...............................63
State...........................................................................
................................................................................
.........................64
State and Pythagoras............................................................
................................................................................
..............64
Chained APIs....................................................................
................................................................................
........................................66
Introduction....................................................................
................................................................................
............................66
Tests...........................................................................
................................................................................
.........................66

Updating Core...................................................................
................................................................................
.................66
Updating turing.dom.............................................................
................................................................................
.............67
DOM Root........................................................................
................................................................................
..................67
Namespaces and Chaining.........................................................
................................................................................
.................67
API.............................................................................
................................................................................
.........................68
Previously .........................................................................
................................................................................
..............68
fakeQuery.......................................................................
................................................................................
....................69
Overall Pattern.................................................................
................................................................................
...................70
Chained Events..................................................................
................................................................................
.........................70
API Design......................................................................
................................................................................
...................70
Test............................................................................
................................................................................
.........................70
Implementation..................................................................
................................................................................
.................70
Event Handler Shortcuts and Loop Scoping........................................
................................................................................
......71
Trigger vs. Bind................................................................
................................................................................
..................72
Feature Detection...............................................................
................................................................................
......................................74
querySelectorAll................................................................
................................................................................
.........................74
In the Wild.....................................................................
................................................................................
.....................74
In the Wild.....................................................................
................................................................................
.....................76
Feature Detection Implementation................................................
................................................................................
.............76
Conclusion......................................................................
................................................................................
....................77

Anda mungkin juga menyukai