Practical Prototype and script.aculo.us

von: Andrew Dupont

Apress, 2008

ISBN: 9781430205029 , 352 Seiten

Format: PDF, OL

Kopierschutz: Wasserzeichen

Windows PC,Mac OSX für alle DRM-fähigen eReader Apple iPad, Android Tablet PC's Online-Lesen für: Windows PC,Mac OSX,Linux

Preis: 35,30 EUR

Mehr zum Inhalt

Practical Prototype and script.aculo.us


 

Contents at a Glance

4

Contents

5

About the Author

12

About the Technical Reviewer

13

Acknowledgments

14

Introduction

15

Prototype

16

What You Should Know About Prototype, JavaScript, and the DOM

17

About JavaScript

17

About the DOM

22

About This Book

23

About Prototype

24

Summary

30

Prototype Basics

31

Getting Started

31

The $ Function

32

Object. extend: Painless Object Merging

35

$ A: Coercing Collections into Arrays

38

$$: Complex Node Queries

40

Summary

43

Collections (Or, Never Write a for Loop Again)

44

The Traditional for Loop

44

Functional Programming

45

Prototype’s Enumerable Object

47

Finding Needles in Haystacks: detect, select, reject, and partition

48

Sorting Collections: min, max, and sortBy

49

Advanced Enumeration: map, inject, invoke, and pluck

51

Other Collections That Use Enumerable

54

Summary

61

Ajax: Advanced Client/Server Communication

62

Ajax Rocks

62

Ajax Sucks

63

Prototype’s Ajax Object

63

Advanced Examples: Working with Dynamic Content

75

Summary

102

Events

103

State of the Browser ( Or, How We Got Here)

103

Events: The Crash Course

106

Events and Forms

114

Custom Events

120

Summary

123

Working with the DOM

124

About the DOM API

124

Node Genealogy

124

Prototype’s DOM Extensions

126

Putting It Together

146

Summary

148

Advanced JavaScript: Functional Programming and Class- Based OOP

149

Object- Oriented JavaScript Programming with Prototype

149

Functional Programming

168

Summary

175

Other Helpful Things: Useful Methods on Built-Ins

176

Using String Methods

176

Using JSON

189

Using Object Methods

193

Using Array Methods

197

Summary

198

script.aculo.us

199

What You Should Know About DHTML and script. aculo. us

200

Introducing the CSS Box Model

200

Introducing script. aculo. us

215

Getting Started with script. aculo. us

216

Summary

220

Introduction to script.aculo.us Effects

221

What Are Effects?

221

Why Effects?

221

The Basics of Effects

223

script. aculo. us Effects

226

Putting It All Together

250

Summary

261

Enabling Draggables, Droppables, and Sortables

262

Exploring Draggables

262

Exploring Droppables

269

Exploring Sortables

275

Summary

280

Advanced Controls: Autocompleters, In- Place Editors, and Sliders

281

Adding Autocomplete Functionality

281

Adding In- Place Editing Functionality

291

Adding Sliders

297

Summary

300

Prototype As a Platform

301

Using Code Patterns

301

Solving Browser Compatibility Problems: To Sniff or Not to Sniff?

309

Making and Sharing a Library

314

Summary

318

Index

319