Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Exploring the Core utility functions


Now that we've investigated the Browser component of MooTools, let's check out the Core component.

The Core component contains a plethora of useful functions (15 of them to be exact) that many JavaScript developers believe should have been in native JavaScript. You'll find functions that will check if an object is defined, functions that work with date and time, and a hodgepodge of miscellaneous functions that will save you a lot of code-writing.

Let's delve into the Core by exploring all of its functions.

Checking to see if objects are defined

You can often run into trouble when an object you're trying to access in your script is null or undefined. Because JavaScript allows you to create empty objects and create them on-the-fly without declaring them first, you'll often need to check if an object you're trying to use contains something.

This leads to a lot of if/else statements and try/catch methods. Let MooTools do all the hard work by leveraging some...