Pro JavaScript with MooTools is unlike any other JavaScript book on the market today. While similar books focus on either JavaScript as a language of the browser or how to use JavaScript frameworks, Pro JavaScript with MooTools fills the gap between these topics and moves beyond—exploring the advanced features of JavaScript and how the MooTools framework uses these features to further improve the language itself. The book itself takes a unique three-pronged approach. It first walks you through the advanced features of JavaScript and the MooTools framework, including native augmentation and type creation, a comprehensive discussion of JavaScript functions, object-oriented programming with native JavaScript and MooTools Classes, and the MooTools Class internals. You’ll then learn all about Javascript in the DOM: the Elements classes and its internals, the MooTools Event system, Selector engines and MooTools Slick, Ajax and the Request Object, and animation and the Fx classes. The final section really sets the book apart from all others, as it discusses JavaScript outside the browsers. You’ll take an in-depth look at CommonJS and MooTools, using MooTools outside the browser to build ORM, creating simple CommonJS applications via the MooTools Deck framework, and creating complex server-side applications using Raccoon. What you’ll learn How MooTools augments natives and creates new types via the Type constructor and how it uses the advanced features of JavaScript functions to extend the language. All about object-oriented programming in native JavaScript and MooTools Class counterpart—the internals of the Class Type and other special object-oriented features that the framework adds to the language. How MooTools improves the DOM API via Element and the Events Types; and how Slick, the MooTools selector engine, uses advanced JavaScript features to create a fast and easy way to control the DOM. How MooTools wraps the native XMLHttpRequest to create a truly cross-browser implementation and how the MooTools Fx classes create smooth, powerful animations for the browser. About the CommonJS initiative and MooTools support for it and how MooTools can be used without the DOM to create an ORM that talks to a database outside the browser. About Deck and Raccoon: two simple, yet powerful, frameworks built atop MooTools that enable you to create server-side JavaScript applications. Who this book is for The book is for beginner to advanced MooTools users who want to learn about the internals and deeper areas of the framework, and beginner to advanced users who want to learn about MooTools 2.0. JavaScript programmers will also benefit from learning about the more advanced features of the language and how MooTools uses them. Table of Contents JavaScript and MooTools Functions Objects Classes Classes: The Extras Types JavaScript in a Window Elements Selector Engines Events Request Animation JavaScript without Limits MooTools on Deck Resources Prelim......Page 1 Contents at a Glance......Page 6 Contents......Page 7 Foreword......Page 16 About the Author......Page 17 About the Technical Reviewer......Page 18 Acknowledgments......Page 19 Preface......Page 20 Exploring JavaScript and MooTools......Page 23 JavaScript......Page 25 MooTools......Page 26 Your Toolkit......Page 27 The Wrap Up......Page 32 The Function......Page 33 One Function, Multiple Forms......Page 34 Single-Execution Function......Page 39 Arguments......Page 42 Return Values......Page 46 Function Internals......Page 47 Advanced Function Techniques......Page 58 MooTools and Functions......Page 64 The Wrap Up......Page 68 JavaScript is Prototypal(-ish)......Page 69 A Language of Objects......Page 70 The Building Blocks of Objects......Page 72 Inheritance......Page 78 The Prototype Chain......Page 83 Simplified Prototypal Programming......Page 87 The Wrap Up......Page 90 From Prototypes to Classes......Page 93 The MooTools Class System......Page 95 Constructors and Initializers......Page 97 Rethinking Members......Page 99 Inheritance......Page 105 Mixins......Page 113 The Wrap Up......Page 118 Mutators......Page 121 The Built-in Mixins......Page 128 Static Members......Page 136 Encapsulation and Visibility......Page 140 MooTools and Classes......Page 147 The Wrap-Up......Page 148 Values and Type Systems......Page 149 An Alternative Type System......Page 151 Native Types and Values......Page 153 Type Casting......Page 165 The MooTools Type System......Page 169 Working with Type Objects......Page 174 Creating New Types......Page 182 The Wrap-Up......Page 190 Conquering the Client Side......Page 193 A Language for Every Computer......Page 195 Life Cycle of a Page......Page 196 Pause, Script......Page 197 The Scripted Browser......Page 198 Frameworks, Libraries, and Toolkits......Page 204 MooTools and the Browser......Page 205 The Wrap-Up......Page 208 Families and Trees......Page 209 Is My DOM Ready Yet?......Page 213 DOM Scripting with MooTools......Page 220 The Element Type......Page 257 The Universal Modificators......Page 261 Element Storage......Page 263 The Wrap Up......Page 264 What Node?......Page 267 Selecting in Style......Page 270 Slick: the MooTools Selector Engine......Page 274 Inside Slick......Page 278 The Wrap-Up......Page 281 A Loopy World......Page 283 The Event Loop......Page 285 Event-Based Programming......Page 286 The Event Models......Page 287 The MooTools Event System......Page 310 Event System Internals......Page 318 The Wrap-Up......Page 328 Requests and Responses......Page 329 The XMLHttpRequest Object......Page 331 Going Async......Page 336 The MooTools Request Class......Page 341 Subclassing Request......Page 357 The Wrap-Up......Page 359 Getting Animated......Page 361 Being Stylish......Page 362 Time for Some Action......Page 365 A Basic JavaScript Animation......Page 368 MooTools Fx Classes......Page 371 Fx Internals......Page 376 The Wrap-Up......Page 379 Breaking from the Browser......Page 381 Breaking out of the Browser......Page 383 CommonJS......Page 384 Common Modules......Page 385 MooTools and CommonJS......Page 389 Meso: MooTools in the Middle......Page 390 The Wrap-Up......Page 391 Revisiting Request and Response......Page 393 JSGI......Page 395 Enter Deck......Page 401 Deck Internals......Page 406 The Wrap-Up......Page 407 The Wrap-Up to Conquer All Wrap-Ups......Page 408 MooTools......Page 409 Index......Page 411 Annotation Pro JavaScript with MooTools is unlike any other JavaScript book on the market today. While similar books focus on either JavaScript as a language of the browser or how to use JavaScript frameworks, Pro JavaScript with MooTools fills the gap between these topics and moves beyondexploring the advanced features of JavaScript and how the MooTools framework uses these features to further improve the language itself. The book itself takes a unique three-pronged approach. It first walks you through the advanced features of JavaScript and the MooTools framework, including native augmentation and type creation, a comprehensive discussion of JavaScript functions, object-oriented programming with native JavaScript and MooTools Classes, and the MooTools Class internals. Youll then learn all about Javascript in the DOM: the Elements classes and its internals, the MooTools Event system, Selector engines and MooTools Slick, Ajax and the Request Object, and animation and the Fx classes. The final section really sets the book apart from all others, as it discusses JavaScript outside the browsers. Youll take an in-depth look at CommonJS and MooTools, using MooTools outside the browser to build ORM, creating simple CommonJS applications via the MooTools Deck framework, and creating complex server-side applications using Raccoon. What youll learn How MooTools augments natives and creates new types via the Type constructor and how it uses the advanced features of JavaScript functions to extend the language. All about object-oriented programming in native JavaScript and MooTools Class counterpartthe internals of the Class Type and other special object-oriented features that the framework adds to the language. How MooTools improves the DOM API via Element and the Events Types; and how Slick, the MooTools selector engine, uses advanced JavaScript features to create a fast and easy way to control the DOM. How MooTools wraps the native XMLHttpRequest to create a truly cross-browser implementation and how the MooTools Fx classes create smooth, powerful animations for the browser. About the CommonJS initiative and MooTools support for it and how MooTools can be used without the DOM to create an ORM that talks to a database outside the browser. About Deck and Raccoon: two simple, yet powerful, frameworks built atop MooTools that enable you to create server-side JavaScript applications. Who this book is for The book is for beginner to advanced MooTools users who want to learn about the internals and deeper areas of the framework, and beginner to advanced users who want to learn about MooTools 2.0. JavaScript programmers will also benefit from learning about the more advanced features of the language and how MooTools uses them. Table of Contents JavaScript and MooTools Functions Objects Classes Classes: The Extras Types JavaScript in a Window Elements Selector Engines Events Request Animation JavaScript without Limits MooTools on Deck Resources Pro JavaScript with MooTools is unlike any other JavaScript book on the market today. While similar books focus on either JavaScript as a language of the browser or how to use JavaScript frameworks, Pro JavaScript with MooTools fills the gap between these topics and moves beyond ́ exploring the advanced features of JavaScript and how the MooTools framework uses these features to further improve the language itself. The book itself takes a unique three-pronged approach. It first walks you through the advanced features of JavaScript and the MooTools framework, including native augmentation and type creation, a comprehensive discussion of JavaScript functions, object-oriented programming with native JavaScript and MooTools Classes, and the MooTools Class internals. You ́ ll then learn all about Javascript in the DOM: the Elements classes and its internals, the MooTools Event system, Selector engines and MooTools Slick, Ajax and the Request Object, and animation and the Fx classes. The final section really sets the book apart from all others, as it discusses JavaScript outside the browsers. You ́ ll take an in-depth look at CommonJS and MooTools, using MooTools outside the browser to build ORM, creating simple CommonJS applications via the MooTools Deck framework, and creating complex server-side applications using Raccoon Pt. 1. Exploring JavaScript and MooTools -- JavaScript and MooTools -- Functions -- Objects -- Classes -- Classes: The Extras -- Types -- pt. 2. Conquering the Client Side -- JavaScript in a Window -- Elements -- Selector Engines -- Events -- Request -- Animation -- pt. 3. Breaking from the Browser -- JavaScript without Limits -- MooTools on Deck