100% found this document useful (1 vote)
19 views

Pro JavaScript with MooTools Learning Advanced JavaScript Programming 1st Edition Mark Joseph Obcena (Auth.) - Get instant access to the full ebook with detailed content

The document provides information about the book 'Pro JavaScript with MooTools: Learning Advanced JavaScript Programming' by Mark Joseph Obcena, including download links and ISBN details. It also lists several other recommended JavaScript-related ebooks available for download on ebookultra.com. The content includes a detailed table of contents outlining various chapters and topics covered in the book.

Uploaded by

serotesugath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
19 views

Pro JavaScript with MooTools Learning Advanced JavaScript Programming 1st Edition Mark Joseph Obcena (Auth.) - Get instant access to the full ebook with detailed content

The document provides information about the book 'Pro JavaScript with MooTools: Learning Advanced JavaScript Programming' by Mark Joseph Obcena, including download links and ISBN details. It also lists several other recommended JavaScript-related ebooks available for download on ebookultra.com. The content includes a detailed table of contents outlining various chapters and topics covered in the book.

Uploaded by

serotesugath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Visit https://ebookultra.

com to download the full version and


explore more ebooks or textbooks

Pro JavaScript with MooTools Learning Advanced


JavaScript Programming 1st Edition Mark Joseph
Obcena (Auth.)

_____ Click the link below to download _____


https://ebookultra.com/download/pro-javascript-with-
mootools-learning-advanced-javascript-programming-1st-
edition-mark-joseph-obcena-auth/

Explore and download more ebooks or textbooks at ebookultra.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

MooTools Essentials The Official MooTools Reference for


JavaScript and Ajax Development 1st Edition Aaron Newton

https://ebookultra.com/download/mootools-essentials-the-official-
mootools-reference-for-javascript-and-ajax-development-1st-edition-
aaron-newton/

HTML5 Programming with JavaScript For Dummies 1st Edition


John Paul Mueller

https://ebookultra.com/download/html5-programming-with-javascript-for-
dummies-1st-edition-john-paul-mueller/

Professional XMPP Programming with JavaScript and jQuery


1st Edition Jack Moffitt

https://ebookultra.com/download/professional-xmpp-programming-with-
javascript-and-jquery-1st-edition-jack-moffitt/

JavaScript with Promises 1st Edition Daniel Parker

https://ebookultra.com/download/javascript-with-promises-1st-edition-
daniel-parker/
Eloquent JavaScript A Modern Introduction to Programming
1st Edition Marijn Haverbeke

https://ebookultra.com/download/eloquent-javascript-a-modern-
introduction-to-programming-1st-edition-marijn-haverbeke/

Professional JavaScript Frameworks Prototype YUI ExtJS


Dojo and MooTools Wrox Programmer to Programmer 1st
Edition Leslie M. Orchard
https://ebookultra.com/download/professional-javascript-frameworks-
prototype-yui-extjs-dojo-and-mootools-wrox-programmer-to-
programmer-1st-edition-leslie-m-orchard/

Learn JavaScript and Ajax with w3Schools 1st Edition


W3Schools

https://ebookultra.com/download/learn-javascript-and-ajax-
with-w3schools-1st-edition-w3schools/

Eloquent JavaScript A Modern Introduction to Programming


2nd Edition Marijn Haverbeke

https://ebookultra.com/download/eloquent-javascript-a-modern-
introduction-to-programming-2nd-edition-marijn-haverbeke/

Learning JavaScript Data Structures and Algorithms 2nd


Edition Loiane Groner

https://ebookultra.com/download/learning-javascript-data-structures-
and-algorithms-2nd-edition-loiane-groner/
Pro JavaScript with MooTools Learning Advanced
JavaScript Programming 1st Edition Mark Joseph
Obcena (Auth.) Digital Instant Download
Author(s): Mark Joseph Obcena (auth.)
ISBN(s): 9781430230557, 143023055X
Edition: 1
File Details: PDF, 3.97 MB
Year: 2010
Language: english
Pro JavaScript with
MooTools
Learning Advanced
JavaScript Programming

■■■

Mark Joseph Obcena

i
Pro JavaScript with MooTools: Learning Advanced JavaScript Programming
Copyright © 2010 by Mark Joseph A. Obcena
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN 978-1-4302-3054-0
ISBN 978-1-4302-3055-7 (eBook)
Printed and bound in the United States of America (POD)
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol
with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of
the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject
to proprietary rights.
President and Publisher: Paul Manning
Lead Editors: Frank Pohlmann and Ben Renow-Clarke
Technical Reviewer: Simo Kinnunen
Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick,
Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank
Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Coordinating Editor: Mary Tobin
Copy Editor: Sharon Terdeman
Compositor: MacPS, LLC
Indexer: Julie Grady
Artist: April Milne
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring
Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
[email protected], or visit www.springeronline.com.
For information on translations, please e-mail [email protected], or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our
Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be caused
directly or indirectly by the information contained in this work.
The source code for this book is available to readers at www.apress.com.

ii
To the one who owns my heart.

iii
Contents at a Glance

■Contents ................................................................................................................ v
■Foreword ............................................................................................................ xiv
■About the Author ................................................................................................. xv
■About the Technical Reviewer............................................................................ xvi
■Acknowledgments............................................................................................. xvii
■Preface ............................................................................................................. xviii
Part I: Exploring JavaScript and MooTools .............................................................. 1
■Chapter 1: JavaScript and MooTools .................................................................... 3
■Chapter 2: Functions ........................................................................................... 11
■Chapter 3: Objects ............................................................................................... 47
■Chapter 4: Classes............................................................................................... 71
■Chapter 5: Classes: The Extras ............................................................................ 99
■Chapter 6: Types ............................................................................................... 127
Part II: Conquering the Client Side ....................................................................... 171
■Chapter 7: JavaScript in a Window ................................................................... 173
■Chapter 8: Elements .......................................................................................... 187
■Chapter 9: Selector Engines .............................................................................. 245
■Chapter 10: Events ............................................................................................ 261
■Chapter 11: Request .......................................................................................... 307
■Chapter 12: Animation ...................................................................................... 339
Part III: Breaking from the Browser ..................................................................... 359
■Chapter 13: JavaScript without Limits.............................................................. 361
■Chapter 14: MooTools on Deck.......................................................................... 371
■Appendix: Resources......................................................................................... 387
■Index ................................................................................................................. 389

iv
Contents

■Contents at a Glance ............................................................................................ iv


■Foreword ............................................................................................................ xiv
■About the Author ................................................................................................. xv
■About the Technical Reviewer............................................................................ xvi
■Acknowledgments............................................................................................. xvii
■Preface ............................................................................................................. xviii

Part I: Exploring JavaScript and MooTools .............................................................. 1


■Chapter 1: JavaScript and MooTools .................................................................... 3
JavaScript ....................................................................................................................... 3
MooTools......................................................................................................................... 4
The Language Extension ................................................................................................. 5
Your Toolkit ..................................................................................................................... 5
JavaScript Interpreter ............................................................................................................................ 6
JavaScript Console ................................................................................................................................ 6
MooTools Core and the Snippet Runner................................................................................................. 8
Code Editor and JSLint ........................................................................................................................... 9
The Wrap Up ................................................................................................................. 10
■Chapter 2: Functions ........................................................................................... 11
The Function ................................................................................................................. 11
One Function, Multiple Forms ....................................................................................... 12
Function Declaration ............................................................................................................................ 12
Function Expression ............................................................................................................................. 14
Named Function Expression ................................................................................................................ 15

v
■ CONTENTS

Single-Execution Function ............................................................................................ 17


Function Object .................................................................................................................................... 19
Arguments .................................................................................................................... 20
Return Values ................................................................................................................ 24
Function Internals ......................................................................................................... 25
Executable Code and Execution Contexts ............................................................................................ 25
Variables and Variable Instantiation..................................................................................................... 27
Scoping and the Scope Chain .............................................................................................................. 29
Closures ............................................................................................................................................... 31
The “this” Keyword .............................................................................................................................. 33
Advanced Function Techniques .................................................................................... 36
Limiting Scope ..................................................................................................................................... 36
Currying ............................................................................................................................................... 38
Decoration ............................................................................................................................................ 39
Combination ......................................................................................................................................... 41
MooTools and Functions ............................................................................................... 42
Function Binding .................................................................................................................................. 43
Extending Functions with Methods ...................................................................................................... 44
The Wrap Up ................................................................................................................. 46
■Chapter 3: Objects ............................................................................................... 47
JavaScript is Prototypal(-ish) ........................................................................................ 47
A Language of Objects .................................................................................................. 48
The Building Blocks of Objects ..................................................................................... 50
Constructor Functions .......................................................................................................................... 50
Prototypes ............................................................................................................................................ 53
Inheritance .................................................................................................................... 56
The Prototype Chain ...................................................................................................... 61
Deliberate Chains ................................................................................................................................. 63
Simplified Prototypal Programming .............................................................................. 65

vi
■ CONTENTS

The Wrap Up ................................................................................................................. 68


■Chapter 4: Classes............................................................................................... 71
From Prototypes to Classes .......................................................................................... 71
The MooTools Class System ......................................................................................... 73
Constructors and Initializers ......................................................................................... 75
Rethinking Members ..................................................................................................... 77
Rethinking Methods ............................................................................................................................. 78
Rethinking Properties........................................................................................................................... 80
Inheritance .................................................................................................................... 83
Overridden Methods ............................................................................................................................. 86
Inside this.parent() ............................................................................................................................... 90
Mixins............................................................................................................................ 91
The Wrap Up ................................................................................................................. 96
■Chapter 5: Classes: The Extras ............................................................................ 99
Mutators ........................................................................................................................ 99
Implementing Your Own Mutators ..................................................................................................... 101
Mutator Gotchas ................................................................................................................................. 104
The Built-in Mixins ...................................................................................................... 106
The Chain Mixin ................................................................................................................................. 106
The Events Mixin ................................................................................................................................ 109
The Options Mixin .............................................................................................................................. 112
Static Members ........................................................................................................... 114
Encapsulation and Visibility ........................................................................................ 118
Private Methods ................................................................................................................................. 120
Protected Methods ............................................................................................................................. 121
MooTools and Classes ................................................................................................ 125
The Wrap-Up ............................................................................................................... 126
■Chapter 6: Types ............................................................................................... 127
Values and Type Systems ........................................................................................... 127

vii
■ CONTENTS

An Alternative Type System ........................................................................................ 129


Native Types and Values ............................................................................................. 131
Null and Undefined ............................................................................................................................. 131
Primitive Types .................................................................................................................................. 132
Composite Types ................................................................................................................................ 135
Type Casting ............................................................................................................... 143
Casting Using Constructors ................................................................................................................ 144
Casting Using Native Functions and Idioms ....................................................................................... 145
The MooTools Type System ........................................................................................ 147
The Type Constructor and Function Subclassing ............................................................................... 147
Instance Checking .............................................................................................................................. 148
Type Detection ................................................................................................................................... 151
Working with Type Objects ......................................................................................... 152
Implementing New Members ............................................................................................................. 153
Aliases and Mirroring ......................................................................................................................... 155
The extend Method and Generics ...................................................................................................... 158
Creating New Types .................................................................................................... 160
A Table Type ...................................................................................................................................... 160
The Table Constructor ........................................................................................................................ 162
Setter, Getter, and Removal ............................................................................................................... 163
Membership Methods ........................................................................................................................ 164
Keys, Values and Traversals .............................................................................................................. 165
Our Final Type .................................................................................................................................... 167
The Wrap-Up ............................................................................................................... 168
Part II: Conquering the Client Side ....................................................................... 171
■Chapter 7: JavaScript in a Window ................................................................... 173
A Language for Every Computer ................................................................................. 173
Life Cycle of a Page .................................................................................................... 174
Pause, Script ............................................................................................................... 175

viii
■ CONTENTS

The Scripted Browser ................................................................................................. 176


The Document Object Model .............................................................................................................. 177
The Browser Object Model ................................................................................................................. 178
Frameworks, Libraries, and Toolkits........................................................................... 182
MooTools and the Browser ......................................................................................... 183
Fixing Browsers with MooTools ......................................................................................................... 183
Browser Detection ............................................................................................................................. 185
Feature Detection ............................................................................................................................... 185
The Wrap-Up ............................................................................................................... 186
■Chapter 8: Elements .......................................................................................... 187
Families and Trees ...................................................................................................... 187
Is My DOM Ready Yet? ................................................................................................ 191
DOM Scripting with MooTools ..................................................................................... 198
Selecting Elements ............................................................................................................................ 198
An Elemental Segue ........................................................................................................................... 215
Moving Elements Around ................................................................................................................... 218
Modifying Element Objects ................................................................................................................ 227
Creating Elements .............................................................................................................................. 231
Destroying Elements .......................................................................................................................... 235
The Element Type ....................................................................................................... 235
Revisiting document.id ...................................................................................................................... 236
Extending Element ............................................................................................................................. 238
The Elements Type...................................................................................................... 239
The Universal Modificators ......................................................................................... 239
Element Storage ......................................................................................................... 241
The Wrap Up ............................................................................................................... 242
■Chapter 9: Selector Engines .............................................................................. 245
What Node?................................................................................................................. 245
Selecting in Style ........................................................................................................ 248

ix
■ CONTENTS

Selector Engines ................................................................................................................................ 249


A Whirlwind Tour of CSS Selector Notation ....................................................................................... 249
Slick: the MooTools Selector Engine........................................................................... 252
Selecting Elements with Slick............................................................................................................ 252
Combinator Prefixes ........................................................................................................................... 253
Reverse Combinators ......................................................................................................................... 254
Pseudo-Selector Functions ................................................................................................................ 255
Inside Slick.................................................................................................................. 256
The Slick Parser Engine ..................................................................................................................... 256
The Slick Selection Engine ................................................................................................................. 258
The Wrap-Up ............................................................................................................... 259
■Chapter 10: Events ............................................................................................ 261
A Loopy World ............................................................................................................. 261
The Event Loop ........................................................................................................... 263
Event-Based Programming ......................................................................................... 264
The Event Models........................................................................................................ 265
The Internet Explorer Model ............................................................................................................... 265
The DOM Level 2 Model ..................................................................................................................... 273
The MooTools Event System ....................................................................................... 288
Attaching Event Handlers ................................................................................................................... 288
Preventing Default Action .................................................................................................................. 291
Stopping Event Propagation ............................................................................................................... 292
Stopping Events All Together ............................................................................................................. 293
Detaching Event Handlers .................................................................................................................. 294
Dispatching Events ............................................................................................................................ 295
Event System Internals ............................................................................................... 296
The Event Type ................................................................................................................................... 296
Two Layers ......................................................................................................................................... 299
The Event Table.................................................................................................................................. 299
Event Handler Wrapping .................................................................................................................... 300

x
■ CONTENTS

Event Handler Detachment and Dispatch .......................................................................................... 304


Custom Events ................................................................................................................................... 305
The Wrap-Up ............................................................................................................... 306
■Chapter 11: Request .......................................................................................... 307
Requests and Responses ............................................................................................ 307
The XMLHttpRequest Object ....................................................................................... 309
Going Async ................................................................................................................ 314
The MooTools Request Class ...................................................................................... 319
Creating New Requests...................................................................................................................... 320
Adding Request Headers .................................................................................................................... 321
Sending Data ...................................................................................................................................... 322
Attaching Event Handlers ................................................................................................................... 323
Timeouts ............................................................................................................................................ 328
Event Handler Declarations ................................................................................................................ 330
Sending the Request .......................................................................................................................... 331
Request Sending Modes .................................................................................................................... 332
Our Final Code .................................................................................................................................... 333
Subclassing Request................................................................................................... 335
Request Internals ............................................................................................................................... 335
Success Overriding ............................................................................................................................ 336
The Wrap-Up ............................................................................................................... 337
■Chapter 12: Animation ...................................................................................... 339
Getting Animated ........................................................................................................ 339
Being Stylish ............................................................................................................... 340
CSS Styles .......................................................................................................................................... 341
Explicit, Implicit, and Computed ........................................................................................................ 342
Revisiting Style Methods.................................................................................................................... 342
Time for Some Action.................................................................................................. 343
Timers ................................................................................................................................................ 343

xi
■ CONTENTS

Timer Execution ................................................................................................................................. 345


A Basic JavaScript Animation ..................................................................................... 346
MooTools Fx Classes................................................................................................... 349
Animation Objects .............................................................................................................................. 349
Tween and Morph .............................................................................................................................. 351
Fx Methods and Events ...................................................................................................................... 353
Fx Internals ................................................................................................................. 354
The Fx Base Class .............................................................................................................................. 354
CSS Animation ................................................................................................................................... 356
The Wrap-Up ............................................................................................................... 357
Part III: Breaking from the Browser ..................................................................... 359
■Chapter 13: JavaScript without Limits.............................................................. 361
Breaking out of the Browser ....................................................................................... 361
CommonJS .................................................................................................................. 362
Common Modules ....................................................................................................... 363
Export and Require............................................................................................................................. 363
Module Paths ..................................................................................................................................... 365
MooTools and CommonJS .......................................................................................... 367
Meso: MooTools in the Middle .................................................................................... 368
The Wrap-Up ............................................................................................................... 369
■Chapter 14: MooTools on Deck.......................................................................... 371
Revisiting Request and Response ............................................................................... 371
JavaScript on the Server............................................................................................. 373
JSGI ............................................................................................................................. 373
JSGI and CommonJS Engines ............................................................................................................ 376
A Common Deck ................................................................................................................................. 379
Enter Deck .................................................................................................................. 379
Getting Decked ................................................................................................................................... 380
Routing ............................................................................................................................................... 381

xii
■ CONTENTS

Middleware using Modules ................................................................................................................ 382


Deck Internals ............................................................................................................. 384
Request and Response ...................................................................................................................... 384
The Filtered Model ............................................................................................................................. 384
Dispatching ........................................................................................................................................ 385
The Router.......................................................................................................................................... 385
The Wrap-Up ............................................................................................................... 385
The Wrap-Up to Conquer All Wrap-Ups ....................................................................... 386
■Appendix: Resources ......................................................................................... 387
JavaScript ................................................................................................................... 387
MooTools..................................................................................................................... 387
■Index ................................................................................................................. 389


xiii
■ CONTENTS

Foreword

I began working on MooTools in 2005, and, after a year of development, I released the very first version
to the public. MooTools slowly gained popularity, ascending to its current position as one of the top
JavaScript frameworks.
MooTools, however, has a rather steep learning curve and a very big codebase. It was never written
with absolute beginners in mind, so users are often intimidated about trying to learn it. This is
unfortunate; they’re missing out on the great power and customizability MooTools offers, simply
because it looks scary.
It is not all MooTools’ fault, of course. There’s a distinct lack of useful information available on the
subject, though I must admit that MooTools itself hasn’t done enough to correct the situation. People
who want to learn the framework are left to their own devices—and that can get really at times.
Fortunately, that’s where this book comes in. Pro JavaScript with MooTools will take you on a journey
from the building blocks of JavaScript, through the prototypal concepts, to the very inner workings of
MooTools. By the time you’re finished reading it, MooTools will hold no more secrets from you.
When I think about the best MooTools articles I have ever read on the Web, Mark’s blog, Keetology,
comes immediately to mind. Mark has been writing awesome JavaScript and MooTools material for
years, in articles (like his “Up the Moo herd” series) and in actual code (Raccoon!). His blog is a must-
read for anyone wanting to learn or expand his knowledge of MooTools, or JavaScript in general.
Pro JavaScript with MooTools isn’t simply a well-written technical book. This book thoroughly
explains how object-oriented programming works in JavaScript, and then gradually takes advantage of
your newly acquired knowledge to explain how MooTools operates, and how you can build awesome
stuff with it.
And awesome stuff is what we want you to build! MooTools is no longer an obscure framework that
sprang from a simple effects library. It’s now a full-fledged development tool with a great set of core
developers, an active and growing community, and a huge roll of user-developed applications and extensions.
But development doesn’t end with the recent successes. While this book is about MooTools 1.3, the
most recent release, it is also a preparation of sorts for version 2.0. MooTools 1.3 reflects the direction
we’re heading in the future—toward a better, faster, and more powerful MooTools. We’re working to
make the strong parts of the framework even stronger, and we’re going to improve the parts that need
improvement.
However, we want you to share in these exciting developments, and the first step toward that is
learning more about MooTools. You don’t need to be an expert to learn MooTools, as this book will show
you. All you need is a little patience, creativity—and a whole lot of milk.
Back in 2005, MooTools was just a small framework I created for fun and experimentation. It never
occurred to me that it would eventually become the subject of a book, a book whose range, I must say, is
as impressive as its depth. It makes me proud of what MooTools has achieved.
Things are just gonna get more awesome from here…
Valerio Proietti
MooTools Founder and Lead-Developer

xiv
About the Author

■ Mark Joseph Obcena is a freelance software developer, graphic designer, and writer
from Manila, Philippines. Popularly known as keeto online, Mark is a big fan of open
source development and regularly contributes to several open source projects,
including MooTools where he’s a member of the official Community Team. He’s
currently experimenting with new programming languages while working on several
CommonJS projects, which are available from his Github page, and he sometimes
gets bullied by the MooTools community into writing a post for his web site, Keetology
(http://keetology.com).
Mark also owns a cat named Shröddy, who may or may not exist.

xv
■ CONTENTS

About the Technical Reviewer

■ Simo Kinnunen, originally from Helsinki, lives in Tokyo, where he combines the study of the Japanese
language with being a web expert and JavaScript hacker. He is also a Zend engineer, and he spent quite a
large part of this spare time building a rather complicated web text replacement hack called cufón.

xvi
Acknowledgments

I’ve often thought of myself as a one-man show: Mark, the Developer for Every Occasion™. This book,
however, is not mine alone. A lot of people have contributed in one way or another to make this book
possible, and I’d like to take a piece of it to thank them.
First, I want to give a big thank-you to Valerio Proietti, MooTools Founder and Lead Developer, who
has not only given his time to read early drafts of the work, but has also graced this book with a foreword.
You, sir, are truly awesome.
I’d also like to thank the MooTools team—the builders, the contributors, and the creators—who
have tirelessly given their love to the framework. This book would literally not have been possible if not
for the great work that you’ve put into MooTools. Special thanks to Christoph, Djamil, William, David,
and Thomas, who have given their input, pings, and thumbs-up for the book.
A thank-you also goes out to the members of the MooTools community, especially the regulars of
the #mootools IRC channel. Your constant need for updates about the book and unending
encouragement drove me to make this work worthy of the highlights. Thanks and []/ are also due to the
regulars of the “other” mootools IRC channel: Jabis, Michael, Graham, and Rud. You guys are all
awesome.
Of course, I won’t forget to thank Simo, my dear technical reviewer, who has given his time and
effort in reviewing the drafts of this work. Thank you for putting up with my dangling semicolons.
Chocolates and thank-yous are sent to Tokyo for you.
Another round of cheers and claps are also given to the people at Apress who believed enough in
this work to put their time into it. To Frank, thank you for giving me the chance to broadcast my ideas to
the world, and thank you for believing that I could pull off this work. To Mary and Ben, thank you for
putting up with my haphazard writing styles and weird submission schedule. And to Sharon, thank you
for adding more awesome to my writing.
Of course, I’d also like to give thanks and hugs to my family. To my mom and dad who have always
believed in me in their own quirky way, to my siblings Christine and Jan Raleigh who are now learning
the value of being connected, and to my aunt and uncle who have stood by me like a second set of
parents, thank you.
Finally, I’d like to give the biggest thanks to three people by dedicating parts of the book to them.
Part I is dedicated to my friend Garrick Cheung. Without you, this book would have never been
started. Thank you for the input, the critiques and the ideas. You are a great man, an awesome person,
and a very good friend. To Happiness.
Part II is dedicated to my very good friend Tim Wienk. Without you, this book would never have
been completed. Thank you for listening to my rants, thank you for keeping me company, thank you for
keeping me sane, and thank you for being a good friend. To Friendship.
And Part III is dedicated to P.E.M. Without you, I would have never gotten the courage to find
happiness. Thank you for showing me what’s wrong, what’s changing, and what’s possible. I’ll always be
your Marquito. To Love.

xvii
■ CONTENTS

Preface

The universe, perhaps, is just a crazy runtime environment with sparse documentation and seemingly
random side effects, and life is nothing more than a program written in a language called “Universcript.”
I conclude that this might be the case because, when I decided to invoke my audition method in the fall
of 2008 to try out for the role of Moritz Stiefel in a local production of Spring Awakening, I never
expected that it would return a Book object.
Fortunately, not all things are that quirky. The universe might think that it’s a great idea to take my
botched audition and turn it into a writing opportunity—an API decision I fully approve, by the way—but
most programming languages behave more predictably. Some languages behave predictably well, some
languages behave predictably well with some exceptions, and some languages behave predictably weird.
The fascinating thing, though, is that a language’s predictability often has less to do with the
language itself and more to do with its users. The more we learn about a programming language, the
more predictable it becomes. The key, then, isn’t coding blindly and whining (quite loudly for some)
about a language’s apparent shortcomings, but learning, experimenting, and applying. The quirks will
stay quirky, but at least now we can appreciate their quirkiness.
This book is about JavaScript as it relates to the MooTools framework. Like any other language,
JavaScript’s predictability has a lot to do with the people who code with it. While it is pretty predictable,
JavaScript does have some quirks and unique features that might not be apparent at base level.
Unfortunately, a lot of us who proudly proclaim to be JavaScript developers don’t take time to learn the
language enough to appreciate these quirks and features.
A big part of this problem, surprisingly, comes from the popularity of frameworks. JavaScript’s
almost prodigal-son-like comeback into the limelight of web development has brought forth a slew of
libraries and frameworks that promise an easier experience when working with the language. While
most of them do deliver on the promise, it comes with the cost of dependency: developers get so
comfortable with a framework that they forget there’s a powerful language underneath the abstraction.
This book tries to address this particular issue for the MooTools framework. MooTools is in the
unique position of being one of the more popular frameworks that extend and improve JavaScript rather
than bury it in the guise of an API. MooTools works with native JavaScript, uses native JavaScript, and
feels like native JavaScript. MooTools users, therefore, are exposed to the power of JavaScript at every
level—all they have to do is look at it.
If you’re looking for a recipe book, a how-to book, or a book of source code that you can copy and
paste into your next application, I’m afraid this is not that book. This book is all about exploring
JavaScript and looking at how JavaScript is used for the internals of the MooTools framework. This book
will show you how the features of JavaScript are used inside the framework, and how they come together
to create the very powerful set of APIs we know as MooTools.
In essence, this book is an extension and expansion of the Up the MooTools Herd series I previously
wrote for my blog. As with that series, this book is not aimed at beginners, but at intermediate and
advanced users. So, if you’re new to MooTools or JavaScript, I suggest you put this book on your to-read
list and grab a beginner’s book first.
This book is divided into three parts. The first part is all about JavaScript as ECMAScript, and
focuses on the native features of the language—functions, objects, and types—and the subsystems

xviii
■ PREFACE

inside MooTools that work with these parts. The second part of the book focuses on JavaScript in the
browser and explores subjects such as elements, events, and animation. Finally, the last part of this book
is a short exploration of JavaScript outside the browser and gives an introduction to CommonJS and
MooTools using Deck.
As you’ll learn in the next chapter, MooTools is divided into two main projects: MooTools Core and
MooTools More. In writing this book, I’ve decided to focus solely on MooTools Core, so there’s no
mention of any of the features or extensions found in MooTools More. Also, I’ve limited myself to
MooTools version 1.3 for this book, so any features from or incompatibilities with previous versions are
not mentioned.
And with those words out of the way, it’s time for us to start our exploration. It’s best that we begin
with the opening credits and get to know our dramatis personae. So if you’re ready, let’s meet the cast:
JavaScript and MooTools.

xix
PART I

Exploring JavaScript and


MooTools
Other documents randomly have
different content
for a moment, and then turned round laughing, and went back to his lodging
—laughing the shamefaced rosy laugh of his years, when one can feel one
has been a little ridiculous without feeling one’s self much the worse for it,
and when it strikes rather comically than painfully to find how different
one’s high-flown fancies are, to all the sober arrangements of the every-day
world.
CHAPTER XXXIII.
The end of the season arrived, Cosmo came home, leaving his fellow-
student, who would not even accept an invitation to Norlaw, behind him in
Edinburgh. Cameron thought it half a weakness on his part, the sudden
affection to which the boy had moved him, but he would not yield so much
to it as to lay himself under “an obligation,” nor suffer any one to suppose
that any motive whatever, save pure liking, mingled in the unlikely
friendship he had permitted himself to form. Inveterate poverty teaches its
victims a strange suspiciousness; he was half afraid that some one might
think he wanted to share the comforts of Cosmo’s home; so, as he was not
going home himself, he remained in Edinburgh, working and sparing as
usual, and once more expanding a little with the idea, so often proved vain
hitherto, of getting so much additional work as to provide for his next
session, leaving it free to its own proper studies; and Cosmo returned to
rejoice the hearts of the women in Norlaw.
Who found him grown and altered, and “mair manlike,” and stronger,
and every way improved, to their hearts’ content. The Mistress was not
given to caresses or demonstrations of affection—but when the lad got
home, and saw his mother’s eye brighten, and her brow clear every time she
looked at him, he felt, with a compunction for his own discontented
thoughts, of how much importance he was to the widow, and tried hard to
restrain the instinct of wandering, which many circumstances had combined
to strengthen in his mind, although he had never spoken of it. Discontent
with his present destination for one thing; the example of Huntley and
Patrick; the perpetual spur to his energy which had been before him during
all his stay in Edinburgh, in the person of Cameron; his eager visionary
desire to seek Mary of Melmar, whom the boy had a strong fancy that he
was destined to find; and, above and beyond all, a certain vague ambition,
which he could not have described to any one, but which lured him with a
hundred fanciful charms—moved him to the new world and the unknown
places, which charmed chiefly because they were new and unknown.
Cosmo had written verses secretly for a year or two, and lately had sent
some to an Edinburgh paper, which, miracle of fortune! published them. He
was not quite assured that he was a poet, but he thought he could be
something if he might but reach that big, glorious world which all young
fancies long for, and the locality of which dazzling impossible vision, is so
oddly and so often placed in London. Cosmo was not sure that it was in
London—but he rather thought it was not in Edinburgh, and he was very
confident it could not be in Norlaw.
About the same time, Joanna Huntley came home for the long summer
holidays. Joanna had persuaded her father into giving her a pony, on which
she trotted about everywhere unattended, to the terror of her mother and the
disgust of Patricia, who was too timid for any such impropriety. Pony and
girl together, on their rambles, were perpetually falling in with Cosmo
Livingstone, whom Joanna rather meant to make a friend of, and to whom
she could speak on one subject which occupied, at the present time, two
thirds of her disorderly thoughts, and deafened, with perpetual repetition,
the indifferent household of Melmar.
This was Desirée. The first of first loves for a girl is generally another
girl, or young woman, a little older than herself; and nothing can surpass the
devotion of the worshiper.
Desirée was only a year older than Joanna, but she was almost every
thing which Joanna was not; and she was French, and had been in Paris and
London, and was of a womanly and orderly temper, which increased the
difference in years. She was, for the time being, Joanna’s supreme mistress,
queen, and lady-love.
“I’m very glad you saw her, Cosmo,” cried the girl, in one of their
encounters, “because now you’ll know that what I say is true. They laugh at
me at Melmar; and Patricia (she’s a cat!) goes on about her Clapham
school, and says Desirée is only a little French governess—as if I did not
know better than that!”
“Is she a governess?” asked Cosmo.
“She’s a lady!” said Joanna, reddening suddenly; “but she does not pay
as much as we do; and she talks French with the girls, and sometimes she
helps the little ones on with their music, and—but as for a governess like
madame, or like Miss Trimmer, or even Mrs. Payne herself—she is no more
like one of them than you are. Cosmo. I think Desirée would like you!”
“Do you think so?” said Cosmo, with a boyish blush and laugh.
Joanna, however, was far too much occupied to notice his
shamefacedness.
“I’ll tell you just what I would like,” she said, as they went on together,
the pony rambling along at its own will, with the reins lying on its neck,
while Cosmo, half-attracted, half-reluctant, walked by its side. “I don’t
think I should tell you either,” said Joanna, “for I don’t suppose you care
about us. Cosmo Livingstone, I am sure, if I were you, I would hate papa;
but you’ll no’ tell—I would like Desirée to come here and marry my brother
Oswald, and be lady of Melmar. I would not care a bit what became of me.
Though she’s French, there’s nobody like her; and that’s just what I would
choose, if I could choose for myself. Would it not be grand? But you don’t
know Oswald—he’s been away nearly as long as I can mind; but he writes
me letters sometimes, and I like him better than anybody else in the world.”
“Where is he?” said Cosmo.
“He’s in Italy. Whiles he writes about the places, whiles about Melmar;
but he never seems to care for coming home,” said Joanna. “However, I
mean to write him to tell him he must come this summer. Your Huntley is
away too. Isn’t it strange to live at home always the same, and have so near
a friend as a brother far, far away, and never, be able to know what he is
doing? Oswald might be ill just now for any thing we know; but I mean to
write and tell him he must come to see Desirée, for that is what I have set
my heart upon since I knew her first.”
Joanna, for sheer want of breath, came to a pause; and Cosmo made no
reply. He walked on, rather puzzled by the confidence she gave him, rather
troubled by this other side of the picture—the young man in Italy, who very
likely thought himself the unquestionable heir, perfectly entitled to marry
and bring home a lady of Melmar. The whole matter embarrassed Cosmo.
Even his acquaintance with Joanna, which was not of his seeking, seemed
quite out of place and inappropriate. But the girl was as totally unconscious
as the pony of the things called improprieties, and had taken a friendship for
Cosmo as she had taken a love for Desirée—partly because the house of
Norlaw bore a certain romance to her fancy—partly because “papa would
be mad"—and partly because, in all honesty, she liked the boy, who was not
much older, and was certainly more refined and gentle than herself. Joanna
was not remarkably amiable in her present development, but she could
appreciate excellence in others.
“And she’s beautiful, too—don’t you think so?” said Joanna; “not pretty,
like Patricia, nor bonnie, like Katie Logan—but beautiful. I wish I could
bring her to Melmar—I wish Oswald could see her—and I’ll do any thing
in the world rather than let Desirée go to anybody’s house like any other
governess. Isn’t it a shame? A delicate little lady like her has to go and teach
little brats of children, and me that am strong and big, and could do lots of
things—I never have any thing to do! I don’t understand it—they say it’s
providence. I would not make things be like that if it was me. What do you
think? You never say a word. I suppose you just listen, and laugh at me
because I speak every thing out. What for do you not speak like a man?”
“A man sometimes has nothing to say, Miss Huntley,” said Cosmo, with
a rather whimsical shyness, which he was half-inclined himself to laugh at.
“Miss Huntley!—I’m Joanna!” cried the girl, with contempt. “I would
like to be friends with you, Cosmo, because papa behaved like a wretch to
your father; and many a time I think I would like to come and help Mrs.
Livingstone, or do any thing for any of you. I canna keep in Melmar in a
corner, and never say a word to vex folk, like Patricia, and I canna be good,
like Katie Logan. Do you want to go away and no’ to speak to me? You can
if you like—I don’t care! I know I’m no’ like a lady in a ballad; but neither
are you like one of the old knights of Norlaw!”
“Not if you think me rude, or dull, or ungrateful for your frankness!”
cried Cosmo, touched by Joanna’s appeal, and eager to make amends; but
the girl pulled up the pony’s reins, and darted away from him in mighty
dudgeon, with the slightest touch of womanish mortification and shame
heightening her childish wrath. Perhaps this was the first time it had really
occurred to Joanna that, after all, there was a certain soul of truth in the
proprieties which she hated, and that it might not be perfectly seemly to
bestow her confidence, unasked, upon Cosmo—a confidence which was
received so coldly.
She comforted herself by starting off at a pace as near a gallop as she
and her steed were equal to, leaving Cosmo rather disconcerted in his turn,
and not feeling particularly pleased with himself, but with many thoughts in
his mind, which were not there when he left Norlaw.
CHAPTER XXXIV.
Day by day, the summer went over Cosmo’s head, leaving his thoughts
in the same glow and tumult of uncertainty, for which, now and then, the
lad blamed himself bitterly, but which, on the whole, he found very
bearable. Every thing went on briskly at Norlaw. The Mistress, thoroughly
occupied, and feeling herself, at last, after so many unprosperous years,
really making some forward progress, daily recovered heart and spirit, and
her constant supervision kept every thing alive and moving in the house.
Here Cosmo filled the place of natural privilege accorded to him alike as
the youngest child and the scholar-son. Though the Mistress’s heart yearned
over the boys who were away, she expected to be most tenderly proud of
Cosmo, whose kirk and manse she could already see in prospect.
It is not a very great thing to be a minister of the Church of Scotland,
but, in former days, at least, when the Church was less divided than it is
now, the people of Scotland regarded with a particular tenderness of
imagination the parish pastor. He was less elevated above his flock than the
English rector, and sprang very seldom from the higher classes; but even
among wealthy yeomen families in the country, the manse was still a kind
of beau ideal of modest dignity and comfort, the pride and favorite fancy of
the people. It was essentially so to the Mistress, whose very highest desire it
had been to move her boy in this direction, and whose project of romance
now, in which her imagination amused itself, was, above all other things,
the future home and establishment of Cosmo. She had no idea to what
extent her favorite idea was threatened in secret.
For the moment, however, Melmar and their connection with that house
seemed to have died out of everybody’s mind save Cosmo’s. It never could
quite pass from his so long as he took his place at sunset in that vacant
window of the old castle, where the ivy tendrils waved about him, and
where the romance of Norlaw’s life seemed to have taken up its dwelling.
The boy could not help wandering over the new ground which Joanna had
opened to him—could not help associating that Mary of Melmar, long lost
in some unknown country, with Oswald Huntley, a stranger from home for
years; and the boy started with a jealous pang of pain to think how likely it
was that these two might meet, and that another than his father’s son should
restore the inheritance to its true heir. This idea was galling in the extreme
to Cosmo. He had never sympathized much in the thought that Melmar was
Huntley’s, nor been interested in any proceedings by which his brother’s
rights were to be established; but he had always reserved for himself or for
Huntley the prerogative of finding and reinstating the true lady of the land,
and Cosmo was human enough to regard “the present Melmar” with any
thing but amiable feelings. He could not bear the idea of being left out
entirely in the management of the concern, or of one of the Huntleys
exercising this champion’s office, and covering the old usurpation with a
vail of new generosity. It was a most uncomfortable view of the subject to
Cosmo, and when his cogitations came to that point, the lad generally
swung himself down from his window-seat and went off somewhere in high
excitement, scarcely able to repress the instant impulse to sling a bundle
over his shoulder and set off upon his journey. But he never could rouse his
courage to the point of reopening this subject with his mother, little witting,
foolish boy, that this admirable idea of his about Oswald Huntley was the
very inducement necessary to make the Mistress as anxious about the
recovery of Mary of Melmar as he himself was—and the only thing in the
world which could have done so.
It happened on one of these summer evenings, about this time, when his
own mind was exceedingly restless and unsettled, that Cosmo, passing
through Kirkbride as the evening fell, encountered bowed Jaacob just out of
the village, on the Melrose road. The village street was full of little groups
in earnest and eager discussion. It was still daylight, but the sun was down,
and lights began to sparkle in some of the projecting gable windows of the
Norlaw Arms, beneath which, in the corner where the glow of the smithy
generally warmed the air, a little knot of men stood together, fringed round
with smaller clusters of women. A little bit of a moon, scarcely so big as the
evening star which led her, was already high in the scarcely shadowed
skies. Every thing was still—save the roll of the widow’s mangle and the
restless feet of the children, so many of them as at this hour were out of bed
—and most of the cottage doors stood open, revealing each its red gleam of
fire, and many their jugs of milk, and bowls set ready on the table for the
porridge or potatoes which made the evening meal. On the opposite brae of
Tyne was visible the minister, walking home with an indescribable
consciousness and disapproval, not in his face, for it was impossible to see
that in the darkness, but in his figure and bearing, as he turned his back
upon his excited parishioners, which was irresistibly ludicrous when one
knew what it meant. Beyond the village, at the opposite extremity, was
Jaacob, in his evening trim, with a black coat and hat, which considerably
changed the little dwarf’s appearance, without greatly improving it. He had
his face to the south, and was pushing on steadily, clenching and opening,
as he walked, the great brown fist which came so oddly out of the narrow
cuff of his black coat. Cosmo, who was quite ready to give up his own
vague fancies for the general excitement, came up to Jaacob quite eagerly,
and fell into his pace without being aware of it.
“Are you going to Melrose for news? I’ll go with you,” said Cosmo.
The road was by no means lonely; there were already both men and boys
before them on the way.
“We should hear to-night, as you ken without me telling you,” said
Jaacob. “I’m gaun to meet the coach; you may come if you like—but what
matter is’t to the like o’ you?”
“To me! as much as to any man in Scotland,” cried Cosmo, growing red;
he thought the dignity of his years was impugned.
“Pish! you’re a blackcoat, going to be,” said Jaacob; “there’s your friend
the minister there, gaun up the brae. I sent him hame wi’ a flea in his lug.
What the deevil business has the like of him to meddle in our concerns? The
country’s coming to ruin, forsooth! because the franchise is coming to a
man like me! Get away with you, callant! as soon as you come to man’s
estate you’ll be like a’ the rest! But ye may just as weel take an honest
man’s, advice, Cosmo. If we dinna get it we’ll tak it, and that’ll be seen
before the world afore mony days are past.”
“What do you think the news will be?” asked Cosmo.
“Think! I’m past thinking,” cried Jaacob, thrusting some imaginary
person away; “haud your tongue—can a man think when he’s wound up the
length of taking swurd in hand, if need should be? If we dinna get it, we’ll
tak it—do ye hear?—that’s a’ I’m thinking in these days.”
And Jaacob swung along the road, working his long arms rather more
than he did his feet, so that their action seemed part of his locomotive
power. It was astonishing, too, to see how swiftly, how steadily, and with
what a “way” upon him, the little giant strode onward, swinging the
immense brown hands, knotted and sinewy, which it was hard to suppose
could ever have been thrust through the narrow cuffs of his coat, like
balancing weights on either side of him. Before them was the long line of
dusty summer road disappearing down a slope, and cut off, not by the sky,
but by the Eildons, which began to blacken in the fading light—behind
them the lights of the village—above, in a pale, warm sky, the one big
dilating star and the morsel of moon; but the thoughts of Jaacob, and even
of Cosmo, were on a lesser luminary—the red lantern of the coach, which
was not yet to be seen by the keenest eyes advancing through the summer
dimness from the south.
“Hang the lairds and the ministers!” cried Jaacob, after a pause, “it’s
easy to see what a puir grip they have, and how well they ken it. Free
institutions dinna agree with the like of primogeniture and thae inventions
of the deevil. Let’s but hae a reformed Parliament, and we’ll learn them
better manners. There’s your grand Me’mar setting up for a leader amang
the crew, presenting an address, confound his impudence! as if he wasna
next hand to a swindler himself.”
“Jacob, do you know any thing about his son?” asked Cosmo, eagerly.
“He’s a virtuoso—he’s a dilettawnti; I ken nae ill of him,” said Jaacob,
who pronounced these titles with a little contempt, yet secretly had a respect
for them; “he hasna been seen in this country, so far as I’ve heard tell of, for
mony a day. A lad’s no aye to blame for his father and his mother; it’s a
thing folk in general have nae choice in—but he’s useless to his ain race,
either as friend or foe.”
“Is he a good fellow, then? or is he like Me’mar?” cried Cosmo.
“Tush! dinna afflict me about thae creatures in bad health,” said Jaacob;
“what’s the use o’ them, lads or lasses, is mair than I can tell—can they no’
dee and be done wi’t? I tell you, a docken on the roadside is mair guid to a
country than the like of Me’mar’s son!”
“Is he in bad health?” asked the persistent Cosmo.
“They’re a’ in bad health,” said Jaacob, contemptuously, “as any auld
wife could tell you; a’ but that red-haired lassie, that Joan. Speak o’ your
changelings! how do ye account to me, you that’s a philosopher, for the like
of an honest spirit such as that, cast into the form of a lassie, and the midst
of a hatching o’ sparrows like Me’mar? If she had but been a lad, she would
have turned them a’ out like a cuckoo in the nest.”
“And Oswald Huntley is ill—an invalid?” said Cosmo, softly returning
to the thread of his own thoughts.
Jaacob once more thrust with contempt some imaginary opponent out of
the way.
“Get away with you down Tyne or into the woods wi’ your Oswald
Huntleys!” cried Jaacob, indignantly—“do you think I’m heeding about ane
of the name? Whisht! what’s that? Did you hear onything?—haud your
tongue for your life!”
Cosmo grew almost as excited as Jaacob—he seized upon the lowest
bough of a big ash tree, and swung himself up, with the facility of a country
boy, among the fragrant dark foliage which rustled about him as he stood
high among the branches as on a tower.
“D’ye see onything?” cried Jaacob, who could have cuffed the boy for
the noise he made, even while he pushed him up from beneath.
“Hurra! here she comes—I can see the light!” shouted Cosmo.
The lad stood breathless among the rustling leaves, which hummed
about him like a tremulous chorus. Far down at the foot of the slope,
nothing else perceptible to mask its progress, came rushing on the fiery eye
of light, red, fierce, and silent, like some mysterious giant of the night. It
was impossible to hear either hoofs or wheels in the distance, still more to
see the vehicle itself, for the evening by this time was considerably
advanced, and the shadow of the three mystic hills lay heavy upon the road.
“She’s late,” said Jaacob, between his set teeth. The little Cyclops held
tight by the great waving bough of the ash, and set his foot in a hollow of its
trunk, crushing beneath him the crackling underwood. Here the boy and he
kept together breathless, Cosmo standing high above, and his companion
thrusting his weird, unshaven face over the great branch on which he
leaned. “She’s up to Plover ha’—she’s at the toll—she’s stopped. What’s
that! listen!” cried Cosmo, as some faint, far-off sound, which might have
been the cry of a child, came on the soft evening air towards them.
Jaacob made an imperative gesture of silence with one hand, and
grasped at the branch with the other till it shook under the pressure.
“She’s coming on again—she’s up to the Black ford—she’s over the
bridge—another halt—hark again!—that’s not for passengers—they’re
hurraing—hark, Jaacob! hurra! she’s coming—they’ve won the day!”
Jaacob, with the great branch swinging under his hands like a willow
bough, bade the boy hold his peace, with a muttered oath through his set
teeth. Now sounds became audible, the rattle of the hoofs upon the road, the
ring of the wheels, the hum of exclamations and excited voices, under the
influence of which the horses “took the brae” gallantly, with a half-human
intoxication. As they drew gradually nearer, and the noise increased, and the
faint moonlight fell upon the flags and ribbons and dusty branches, with
which the coach was ornamented, Cosmo, unable to contain himself, came
rolling down on his hands and feet over the top of Jaacob, and descended
with a bold leap in the middle of the road. Jaacob, muttering fiercely,
stumbled after him, just in time to drag the excited boy out of the way of the
coach, which was making up for lost time by furious speed, and on which
coachman, guard, and outside passengers, too much excited to be perfectly
sober, kept up their unanimous murmurs of jubilee, with only a very
secondary regard to the road or any obstructions which might be upon it.
“Wha’s there? get out o’ my road, every soul o’ ye! I’ll drive the gait
blindfold, night or day, but I’ll no’ undertake the consequence if ye rin
among my wheels,” cried the driver.
“Hurra! lads! the Bill’s passed—we’ve won! Hurra!” shouted another
voice from the roof of the vehicle, accompanying the shout with a slightly
unsteady wave of a flag, while, with a little swell of sympathetic cheers,
and a triumphant flourish of trumpet from the guard, the jubilant vehicle
dashed on, rejoicing as never mail-coach rejoiced before.
Jaacob took off his hat, tossed it into the air, crushed it between his
hands as it came down, and broke into an extraordinary shout, bellow, or
groan, which it was impossible to interpret; then, turning sharp round,
pursued the coach with a fierce speed, like the run of a little tiger, setting all
his energies to it, swinging his long arms on either side of him, and raising
about as much dust as the mail which he followed. Cosmo, left behind,
followed more gently, laughing in spite of himself, and in spite of the
heroics of the day, which included every national benefit and necessity
within the compass of “the Bill,” at the grotesque little figure disappearing
before him, twisting its great feet, and swinging its arms in that
extraordinary race. When the boy reached Kirkbride, the coach was just
leaving the village amid a chorus of cheers and shouts of triumph. No one
could think of any thing else, or speak of any thing else; everybody was
shaking hands with everybody, and in the hum of amateur speechifying,
half a dozen together, Cosmo had hard work to recall even that sober
personage, the postmaster, who felt himself to some extent a representative
of government and natural moderator of the general excitement, to some
sense of his duties. Cosmo’s exertions, however, were rewarded by the sight
of three letters, with which he hastened home.
CHAPTER XXXV.
“The Reform Bill’s passed, mother! we’ve won the day!” cried Cosmo,
rushing into the Norlaw dining-parlor with an additional hurra! of
exultation. After all the din and excitement out of doors, the summer
twilight of the room, with one candle lighted and one unlit upon the table,
and the widow seated by herself at work, the only one living object in the
apartment, looked somewhat dreary—but she looked up with a brightening
face, and lighted the second candle immediately on her son’s return.
“Eh, laddie, that’s news!” cried the Mistress; “are you sure it’s true? I
didna think, for my part, the Lords had as much sense. Passed! come to be
law!—eh, my Huntley! to think he’s at the other end of the world and canna
hear.”
“He’ll hear in time,” said Cosmo, with a little agitation, producing his
budget of letters. “Mother, I’ve more news than about the Bill. I’ve a letter
here.”
His mother rose and advanced upon him with characteristic vehemence:

“Do you dare to play with your mother, you silly bairn? Give it to me,”
said the Mistress, whom Cosmo’s hurried, breathless, joyful face had
already enlightened; “do you think I canna bear gladness, me that never
fainted with sorrow? Eh Huntley, my bairn!”
And in spite of her indignation, Huntley’s mother sank into the nearest
chair, and let her tears fall on his letter as she opened it. It did not, however,
prove to be the intimation of his arrival, which they hoped for. It was
written at sea, three months after his departure, when he was still not above
half way on his journey; for it was a more serious business getting to
Australia in those days than it is now. Huntley wrote out of his little berth in
the middle of the big ocean, with all the strange creaks of the ship and
voices of his fellow-passengers to bear him company, with a heart which
was still at Norlaw. The Mistress tried very hard to read his letter aloud; she
drew first one and then the other candle close to her, exclaiming against the
dimness of the light; she stopped in the middle of a sentence, with
something very like a sob, to bid Cosmo sharply be quiet and no’ interrupt
her, like a restless bairn, while she read his brother’s letter; but at last the
Mistress broke down and tried no further. It was about ten months since she
bade him farewell, and this was the first token of Huntley’s real person and
existence which for all that lingering and weary time had come to his
mother, who had never missed him out of her sight for a week at a time, all
his life before.
There was not a very great deal in it even now, for letter-writing had
been a science little practiced at Norlaw, and Huntley had still nothing to
tell but the spare details of a long sea voyage; there was, however, in it,
what there is not in all letters, nor in many—even much more affectionate
and effusive epistles than this—Huntley himself. When the Mistress had
come to the end, which was but slowly, in consideration of the dimness of
the candles or her eyes, she gave it to Cosmo, and waited rather impatiently
for his perusal of the precious letter. Then she went over it again, making
hasty excuse, as she did so; for “one part I didna make out,” and finally,
unable to refrain, got up and went to the kitchen, where Marget was still
busy, to communicate the good news.
The kitchen door was open; there was neither blind nor shutter upon the
kitchen-window, and the soft summer stars, now peeping out in half visible
hosts like cherubs, might look in upon Marget, passing back and forward
through the fire light, as much and as often as they pleased. From the open
door a soft evening breath of wind, with the fragrance of new growth and
vegetation upon it, which is almost as sweet as positive odors, came
pleasantly into the ruddy apartment, where the light found a hundred bright
points to sparkle in, from the “brass pan” and copper kettle on the shelf to
the thick yolks of glass in one or two of the window-panes. It was not quite
easy to tell what Marget was doing; she was generally busy, moving about
with a little hum of song, setting every thing in order for the night.
“Marget, my woman, you’ll be pleased to hear—I’ve heard from my
son,” said the Mistress, with unusual graciousness. She came and stood in
front of the fire, waiting to be questioned, and the fire light still shone with
a very prismatic radiance through the Mistress’s eyelashes, careful though
she had been, before she entered, to remove the dew from her eyes.
“You’re no’ meaning Mr. Huntley? Eh! bless him! has he won there?”
cried Marget, letting down her kilted gown, and hastening forward.
And then the Mistress was tempted to draw forth her letter, and read “a
bit here and a bit there,” which the faithful servant received with sobs and
exclamations.
“Bless the laddie, he minds every single thing at Norlaw—even the like
of me!” cried Marget; upon which the Mistress rose again from the seat she
had taken, with a little start of impatience:—
“Wherefore should he no’ mind you?—you’ve been about the house a’
his life; and I hope I’ll never live to see the day when a bairn of mine
forgets his hame and auld friends! It’s time to bar the door, and put up the
shutter. You should have had a’ done, and your fire gathered by this time;
but it’s a bonnie night!”
“ ’Deed, ay!” said Marget to herself, when Huntley’s mother had once
more joined Cosmo in the dining-room; “the bonniest night that’s been to
her this mony a month, though she’ll no’ let on—as if I didna ken how her
heart yearns to that laddie on the sea, blessings on him! Eh, sirs! to think o’
thae very stars shining on the auld castle and the young laird, though the
world itsel’s between the twa—and the guid hand of Providence ower a’—
God be thanked!—to bring the bairn hame!”
When the Mistress returned to the dining-parlor, she found Cosmo quite
absorbed with another letter. The lad’s face was flushed with half-abashed
pleasure, and a smile, shy, but triumphant, was on his lip. It was not Patie’s
periodical letter, which still lay unopened before her own chair, where it had
been left in the overpowering interest of Huntley’s. The Mistress was not
perfectly pleased. To care for what anybody else might write—“one of his
student lads, nae doubt, or some other fremd person,” in presence of the
first letter from Huntley, was almost a slight to her first-born.
“You’re strange creatures, you laddies,” said the Mistress. “I dinna
understand you, for my part. There are you, Cosmo Livingstone, as pleased
about your nonsense letter, whatever it may be, as if there was no such
person as my Huntley in the world—him that aye made such a wark about
you!”
“This is not a nonsense letter—will you read it, mother?” said Cosmo.
“Me!—I havena lookit at Patie’s letter yet!” cried the Mistress,
indignantly. “Do you think I’m a person to be diverted with what one
callant writes to another? Hold your peace, bairn, and let me see what my
son says.”
The Mistress accordingly betook herself to Patrick’s letter with great
seriousness and diligence, keeping her eyes steadily upon it, and away from
Cosmo, whom, nevertheless, she could still perceive holding his letter, his
own especial correspondence, with the same look of shy pleasure, in his
hand. Patie’s epistle had nothing of remarkable interest in it, as it happened,
and the Mistress could not quite resist a momentary and troubled
speculation, Who was Cosmo’s correspondent, who pleased him so much,
yet made him blush? Could it be a woman? The idea made her quite angry
in spite of herself—at his age!
“Now, mother, read this,” said Cosmo, with the same smile.
“If it’s any kind of bairn’s nonsense, dinna offer it to me,” said the
Mistress, impatiently. “Am I prying into wha writes you letters? I tell you
I’ve had letters enough for ae night. Peter Todhunter!—wha in the world is
he?”
“Read it, mother,” repeated Cosmo.
The Mistress read in much amazement; and the epistle was as follows:
“North British Courant Office,
“Edinburgh.
“Dear Sir,
“Hearing that you are the C. L. N. who have favored the North British
Courant from time to time with poetical effusions which seem to show a
good deal of talent, I write to ask whether you have ever done any thing in
the way of prose romance, or essays of a humorous character in the style of
Sterne, or narrative poetry. I am just about to start (with a good staff of
well-known contributors) a new monthly, to be called the Auld Reekie
Magazine, a miscellany of general literature; and should be glad to receive
and give my best consideration to any articles from your pen. The rates of
remuneration I can scarcely speak decisively about until the success of this
new undertaking is in some degree established; but this I may say—that
they shall be liberal and satisfactory, and I trust may be the means of
inaugurating a new and better system of mutual support between publishers
and authors—the accomplishment of which has long been a great object of
my life.
“Your obedient servant,
“Peter Todhunter.”
“The North British Courant! poetry! writing for a magazine!—what does
it a’ mean?” cried the Mistress. “Do you mean to tell me you’re an author,
Cosmo Livingstone?—and me never kent—a bairn like you!”
“Nothing but some—verses, mother,” said the boy, with a blush and a
laugh, though he was not insensible to the importance of Mr. Todhunter’s
communication. Cosmo’s vanity was not sufficiently rampant to say poems.
“I did not send them with my name. I wanted to do something better before
I showed them to you.”
“And here they’re wanting the callant for a magazine!” cried the
Mistress. “Naething but a bairn—the youngest! a laddie that was never out
of Norlaw till within six months time! And I warrant they ken what’s for
their ain profit, and what kind of a lad they’re seeking after—and me this
very night thinking him nae better than a bairn!”
And the Mistress laughed in the mood of exquisite pride at its highest
point of gratification, and followed up her laugh by tears of the same. The
boy was pleased, but his mother was intoxicated. The North British Courant
and the Auld Reekie Magazine were glorious in her eyes as celestial
messengers of fame, and she could not but follow the movements of her
boy with the amazed observation of a sudden discovery. He who was
“naething but a bairn” had already proved himself a genius, and Literature
urgent called him to her aid. He might be a Scott—he might turn out a
Shakespeare. The Mistress looked at him with no limit to her wonder, and
for the moment none in her faith.
“And just as good a laddie as he aye was,” she murmured to herself,
stroking his hair fondly—“though mony a ane’s head would have been
clean turned to see themsels in a printed paper—no’ to say in a book. Eh,
bairn! and to think how little I kent, that am your mother, what God had put
among my very bairns!”
“Mother, it may turn out poor enough, after all,” cried Cosmo, half
ashamed—“I don’t know yet myself what I can do.”
“I daresay no’,” said the Mistress, proudly, “but you may take my word
this decent man does, Cosmo, seeing his ain interest is concerned. Na,
laddie, I ken, if you dinna, the ways of this world, and I wouldna say but
they think they’ve got just a prize in my bairn. Eh! if the laddies were but
here and kent!—and oh, Cosmo! what he would have thought of it that’s
gone!”
When the Mistress had dried her eyes, she managed to draw from the
boy a gradual confession that the North British Courant, sundry numbers of
it, were snugly hid in his own trunk up stairs, from which concealment they
were brought forth with much shamefacedness by Cosmo, and read with the
greatest triumph by his mother. The Mistress had no mind to go to rest that
night—she staid up looking at him—wondering over him; and Cosmo
confessed to some of his hitherto secret fancies—how he would like to go
abroad to see new countries, and to hear strange tongues, and how he had
longed to labor for himself.
“Whisht! laddie—I would have been angry but for this,” said the
Mistress. “The like of you has nae call to work; but I canna say onything
mair, Cosmo, now that Providence has taken it out of my hand. And I dinna
wonder you would like to travel—the like of you canna be fed on common
bread like common folk—and you’ll hae to see every thing if you’re to be
an author. Na, laddie, no’ for the comfort of seeing you and hearing you
would I put bars on your road. I aye thought I would live to be proud of my
sons, but I didna ken I was to be overwhelmed in a moment, and you
naething but a bairn!”
CHAPTER XXXVI.
The result of this conversation was that Cosmo made a little private visit
to Edinburgh to determine his own entrance into the republic of letters, and
to see the enterprising projector of the Auld Reekie Magazine through
whom this was to take place. The boy went modestly, half abashed by his
good fortune and dawning dream of fame, yet full of a flush of youthful
hope, sadly out of proportion to any possible pretensions of the new
periodical. He saw it advertised in the newspaper which one of his fellow-
passengers on the coach read on the way. He saw a little printed hand-bill
with its illustrious name in the window of the first bookseller’s shop he
looked into on his arrival in Edinburgh, and Cosmo marched over the North
Bridge with his carpet-bag in his hand, with a swell of visionary glory. He
could not help half wondering what the indifferent people round him would
think, if they knew—and then could not but blush at himself for the fancy.
Altogether the lad was in a tumult of delightful excitement, hope, and
pleasure, such as perhaps only falls to the lot of boys who hope themselves
poets, and think at eighteen that they are already appreciated and on the
highway to fame.
As he ascended the stairs to Mrs. Purdie’s, he met Cameron coming
down. There was a very warm greeting between them—a greeting which
surprise startled into unusual affectionateness on the part of the Highlander.
Cameron forgot his own business altogether to return with Cosmo, and
needed very little persuasion to enter the little parlor, which no other lodger
had turned up to occupy, and share the refreshment which the overjoyed
landlady made haste to prepare for her young guest. This was so very
unusual a yielding on Cameron’s part, that Cosmo almost forgot his own
preoccupation in observing his friend, who altogether looked brightened
and smoothed out, and younger than when they parted. The elder and
soberer man, who knew a little more of life and the world than Cosmo,
though very little more of literature, could not help a half-perceptible smile
at the exuberance of Cosmo’s hopes. Not that Cameron despised the Auld
Reekie Magazine; far from that, the Divinity student had all the reverence
for literature common to those who know little about it, which reverence,
alas! grows smaller and smaller in this too-knowing age. But at thirty years
old people know better than at eighteen how the sublimest undertakings
break down, and how sometimes even “the highest talent” can not float its
venture. So the man found it hard not to smile at the boy’s shy triumph and
undoubting hope, yet could not help but be proud, notwithstanding, with a
tenderness almost feminine, of the unknown gifts of the lad, whose youth,
he could not quite tell how, had found out the womanish corner of his own
reserved heart, in which, as he said himself, only two or three could find
room at any time.
“But you never told me of these poetical effusions, Cosmo,” said his
friend, as he put up the bookseller’s note.
“Don’t laugh at Mr. Todhunter. I only call them verses,” said Cosmo,
with that indescribable blending of vanity and humility which belongs to his
age; “and I knew you would not care for them; they were not worth
showing to you.”
“I’m not a poetical man,” said Cameron, “but I might care for your
verses in spite of that; and now Cosmo, laddie, while you have been
thinking of fame, what novel visitor should you suppose had come to me?”
“Who?—what?” cried Cosmo, with eager interest.
“What?” echoed Cameron, “either temptation or good fortune—it’s hard
to say which—only I incline to the first. Satan’s an active chield, and thinks
little of trouble; but I doubt if the other one would have taken the pains to
climb my stair. I’ve had an offer of a tutorship, Cosmo—to go abroad for
six months or so with a callant like yourself.”
“To go abroad!” Cosmo’s eyes lighted up with instant excitement, and he
stretched his hand across the table to his friend, with a vehemence which
Cameron did not understand, though he returned the grasp.
“An odd enough thing for me,” said the Highlandman, “but the man’s an
eccentric man, and something has possessed him that his son would be in
safe hands; as in safe hands he might be,” added the student in an
undertone, “seeing I would be sorry to lead any lad into evil—but as for fit
hands, that’s to be seen, and I’m far from confident it would be right for
me.”
“Go, and I’ll go with you,” said Cosmo, eagerly. “I’ve set my heart upon
it for years.”
“More temptation!” said the Highlandman. “Carnal inclinations and
pleasures of this world—and I’ve little time to lose. I can not afford a
session—whisht! Comfort and ease to the flesh, and pleasure to the mind,
are hard enough to fight with by themselves without help from you.”
It was almost the first time he had made the slightest allusion to his own
hard life and prolonged struggle, and Cosmo was silent out of respect and
partially in the belief that if Cameron’s mind had not been very near made
up in favor of this new proposal, he would not have suffered himself to
refer to it. The two friends sat up late together that night. Cosmo pouring
out all his maze of half-formed plans and indistinct intentions into
Cameron’s ears—his projects of authorship, his plan for a tragedy of which
Wallace wight should be the hero; of a pastoral poem and narrative,
something between Colin Clout and the Gentle Shepherd—and of essays
and philosophies without end; while Cameron on his part smiled, as he
could not but smile by right of his thirty years, yet somehow began to
believe, like the Mistress, in the enthusiastic boy, with all that youthful
flush and fervor in the face which his triumph and inspiration of hope made
beautiful. The elder man could not give his own confidence so freely as
Cosmo did, but he opened himself as far as it was his nature to do, in
droppings of shy frankness—a little now and a little then—which were in
reality the very highest compliment which such a man could pay to his
companion. When they separated, Cameron, it is true, knew all about
Cosmo, while Cosmo did not know all about Cameron; but the difference
was not even so much a matter of temperament as of years, and the lad,
without hearing many particulars, or having a great deal of actual
confidence given to him, knew the man better at the end of this long
evening than ever he had done before.
In the morning Cosmo got up full of pleasurable excitement, and set out
early to call on Mr. Todhunter. The North British Courant office was in one
of the short streets which run between Princes Street and George Street, and
in the back premises, a long way back, through a succession of rooms,
Cosmo was ushered into the especial little den of the publisher. Mr.
Todhunter was of a yellow complexion, with loose, thick lips, and wiry
black hair. The lips were the most noticeable feature in his face, from the
circumstance that when he spoke his mouth seemed uncomfortably full of
moisture, which gave also a peculiar character to his voice. He was
surrounded by a mass of papers, and had paste and scissors—those
palladiums of the weekly press—by his side. If there was one thing more
than another on which the North British Courant prided itself, it was on the
admirable collection of other people’s opinions which everybody might find
in its columns. Mr. Todhunter made no very great stand upon politics. What
he prized was a reputation which he thought “literary,” and a skill almost
amounting to genius for making what he called “excerpts.”
“Very glad to make your personal acquaintance, Mr. Livingstone,” said
the projector of the Auld Reekie Magazine, “and still more to receive your
assurances of support. I’ve set my heart on making this a real, impartial,
literary enterprise, sir—no’ one of your close boroughs, as they say now-a-
days, for a dozen or a score of favored contributors, but open to genius, sir
—genius wherever it may be—rich or poor.”
Cosmo did not know precisely what to answer, so he filled in the pause
with a little murmur of assent.
“Ye see the relations of every thing’s changing,” said Mr. Todhunter;
“old arrangements will not do—wull not answer, sir, in an advancing age. I
have always held high opinions as to the claims of literary men, myself—
it’s against my nature to treat a man of genius like a shopkeeper; and my
principle, in the Auld Reekie Magazine, is just this—first-rate talent to make
the thing pay, and first-rate pay to secure the talent. That’s my rule, and I
think it’s a very safe guide for a plain man like me.”
“And it’s sure to succeed,” said Cosmo, with enthusiasm.
“I think it wull, sir—upon my conscience, if you ask me, I think it wull,”
said Mr. Todhunter; “and I have little doubt young talent will rally round the
Auld Reekie Magazine. I’m aware it’s an experiment, but nothing shall ever
make me give in to an ungenerous principle. Men of genius must be
protected, sir; and how are they protected in your old-established
periodicals? There’s one old fogy for this department, and another old fogy
for that department; and as for a genial recognition of young talent, take my
word for’t, there’s no such thing.”
“I know,” said Cosmo, “it is the hardest thing in the world to get in. Poor
Chatterton, and Keats, and—”
“Just that,” said Mr. Todhunter. “It’s for the Keatses and the Chattertons
of this day, sir, that I mean to interpose; and no lad of genius shall go to the
grave with a pistol in his hand henceforward if I can help it. I admire your
effusions very much, Mr. Livingstone—there’s real heart and talent in them,
sir—in especial the one to Mary, which, I must say, gave me the impression
of an older man.”
“I am pretty old in practice—I have been writing a great many years,”
said Cosmo, with that delightful, ingenuous, single-minded, youthful vanity,
which it did one’s heart good to see. Even Mr. Todhunter, over his paste and
scissors, was somehow illumined by it, and looked up at the lad with the
ghost of a smile upon his watery lips.
“And what do you mean to provide us for the opening of the feast?” said
the bookseller, “which must be ready by the 15th, at the very latest, and be
the very cream of your inspiration. It’s no small occasion, sir. Have you
made up your mind what is to be your deboo?”
“It depends greatly upon what you think best,” said Cosmo, candid and
impartial; “and as you know what articles you have secured already, I
should be very glad of any hint from you.”
“A very sensible remark,” said Mr. Todhunter. “Well, I would say, a good
narrative now, in fine, stirring, ballad verse—a narrative always pleases the
public fancy—or a spirited dramatic sketch, or a historical tale, to be
completed, say, in the next number. I should say, sir, any one of these would
answer the Auld Reekie;—only be on your mettle. I consider there’s good
stuff in you—real good stuff—but, at the same time, many prudent persons
would tell me I was putting too much reliance on so young a man.”
“I will not disappoint you,” said Cosmo, with a little pride; “but,
supposing this first beginning over, could it do any good to the magazine,
do you think, to have a contributor—letters from abroad—I had some
thoughts—I—I wished very much to know—”
“Were you thinking of going abroad?” said the bookseller, benignantly.
“I can scarcely say think—but, there was an opportunity,” said Cosmo,
with a blush; “that is, if it did not stand in the way of—”
“Auld Reekie? Certainly not—on the contrary, I know nothing I would
like better,” said Mr. Todhunter. “Some fine Italian legends, now, or a few
stories from the Rhine, with a pleasant introduction, and a little romantic
incident, to show how you heard them—capital! but I must see you at my
house before you go. And as for the remuneration, we can scarcely fix on
that, perhaps, till the periodical’s launched—but ye know my principle, and
I may say, sir, with confidence, no man was left in the lurch that put
reliance upon me. I’m a plain man, as you see me, but I appreciate the
claims of genius, and young talent shall not want its platform in this city of
Edinburgh; or, if it does, it shall be no fault of mine.”
With a murmured applause of this sentiment, and in a renewed tumult of
pleasure, Cosmo left his new friend, and went home lingering over the
delightful thought of Italian legends and stories of the Rhine, told in the
very scenes of the same. The idea intoxicated him almost out of
remembrance of Mary of Melmar, and if the boy’s head was not turned, it
seemed in a very fair way of being so, for the sentiments of Mr. Todhunter
—a publisher!—a practical man!—one who knew the real value of
authorship! filled the lad with a vague glory in his new craft. A London
newspaper proprietor, who spoke like the possessor of the North British
Courant, would have been, the chances are, a conscious humbug, and
perhaps so might an Edinburgh bookseller of the present time, who
expressed the same sentiments. Mr. Todhunter, however, was not a humbug.
He was like one of those dabblers in science who come at some simple
mechanical principle by chance, and in all the flush of their discovery, claim
as original and their own what was well known a hundred years since. He
was perfectly honest in the rude yet simple vanity with which he patronized
“young talent,” and in his vulgar, homely fashion, felt that he had quite
seized upon a new idea in his Auld Reekie Magazine—an idea too original
and notable to yield precedence even to the Edinburgh Review.
CHAPTER XXXVII.
The pace of events began to quicken with Cosmo. When he encountered
his fellow-lodger in the evening, he found that Cameron had been
permitting his temptation to gain more and more ground upon him. The
Highlander, humbly born and cottage bred as he was, and till very recently
bounded by the straitest prospects as to the future, had still a deep reserve of
imaginative feeling, far away down where no one could get at it—under the
deposit left by the slow toil and vulgar privations of many years.
Unconsciously to himself, the presence and society of Cosmo Livingstone
had recalled his own boyhood to the laboring man, in the midst of that
sweat of his brow in which he ate his scanty bread in the Edinburgh garret.
Where was there ever boyhood which had not visions of adventure and
dreams of strange countries? All that last winter, through which his boy
companion stole into his heart, recollections used to come suddenly upon
the uncommunicating Highlander of hours and fancies in his own life,
which he supposed he had long ago forgotten—hours among his own hills,
herding sheep, when he lay looking up at the skies, and entranced by the
heroic lore with which he was most familiar, thinking of David’s well at
Bethlehem, and the wine-press where Gideon thrashed his wheat, and the
desert waters where Moses led his people, and of all the glorious unknown
world beside, through which his path must lie to the Holy Land. Want, and
labor, and the steady, desperate aim, with which he pushed through every
obstacle towards the one goal of his ambition, had obscured these visions in
his mind, but Cosmo’s fresh boyhood woke them by degrees, and the
unusual and unexpected proposal lately made to him, had thrilled the cooled
blood in Cameron’s veins as he did not suppose it could be thrilled. Ease,
luxury (to him), and gratification in the meantime, with a reserve fund great
enough to carry him through a session without any extra labor. Why did he
hesitate? He hesitated simply because it might put off for six months—
possibly for a year—the accomplishment of his own studies and the gaining
of that end, which was not a certain living, however humble, but merely a
license to preach, and his chance with a hundred others of a presentation to
some poor rural parish, or a call from some chapel of ease. But he did
hesitate long and painfully. He feared, in his austere self-judgment, to prefer
his own pleasure to the work of God, and it was only when his boy-favorite
came back again and threw all his fervid youthful influence into the scale,
that Nature triumphed with Cameron, and that he began to permit himself to
remember that, toilworn as he was, he was still young, and that the six
months’ holiday might, after all, be well expended. The very morning after
Cosmo’s arrival, after lying awake thinking of it half the night, he had gone
to the father of his would-be-pupil to explain the condition on which he
would accept the charge, which was, that Cosmo might be permitted to join
the little party. Cameron’s patron was a Highlander, like himself—obstinate,
one-sided, and imperious. He did not refuse the application. He only issued
instant orders that Cosmo should be presented to him without delay, that he
might judge of his fitness as a traveling companion—and Cameron left him,
pledged, if his decision should be favorable, to accept the office.
The next day was a great day in Edinburgh—an almost universal
holiday, full of flags, processions, and all manner of political rejoicings—
the Reform Jubilee. Cosmo plunged into the midst of it with all the zeal of a
young politician and all the zest of a school-boy, and was whirled about by
the crowd through all its moods and phases, through the heat, and the dust,
and the sunshine, through the shouts and groans, the applauses and the
denunciations, to his heart’s content. He came in breathless somewhere
about midday, as he supposed, though in reality it was late in the afternoon,
to snatch a hurried morsel of the dinner which Mrs. Purdie had vainly
endeavored to keep warm for him, and to leave a message for Cameron to
be ready for him in the evening, to go out and see the illumination. When
Cosmo reappeared again, flushed, tired, excited, yet perfectly ready to
begin once more, it was already darkening towards night. Cameron was
ready, and the boy was not to be persuaded to lose the night and “the fun,”
which already began to look rather like mischief. The two companions, so
unlike each other, made haste to the Calton Hill, where a great many people
had already preceded them. Oh, dwellers on the plains! oh, cockney
citizens!—spite of your gas stars and your transparencies—your royal
initials and festoons of lamps, don’t suppose that you know any thing about
an illumination; you should have seen the lines of light stealing from slope
to slope along the rugged glory of that antique Edinburgh—the irregular
gleams descending into the valley, the golden threads, here and there
broken, that intersected the regular lines of the new town. Yonder tall
houses, seven stories high, where every man is a Reformer, and where the
lights come out in every window, star by star, in a flicker and glow, as if the
very weakness of those humble candles gave them the animation and
humanness of a breathing triumph—swelling higher towards the dark
Castle, over whose unlighted head the little moon looks down, a serene
spectator of all this human flutter and commotion—undulating down in
rugged breaks towards lowly Holyrood, sometimes only a thin line visible
beneath the roof—sometimes a whole house aglow. The people went and
came, in excited groups, upon the fragrant grass of the Calton Hill;
sometimes turning to the other side of the landscape, to see the more
sparely lighted streets of gentility, or the independent little sparkle which
stout little Leith in the distance threw out upon the Firth—but always
returning with unfailing fascination to this scene of magic—the old town
shining with its lamps and jewels, like a city in a dream.
But it was not destined to be a perfectly calm summer evening’s
spectacle. The hum of the full streets grew riotous even to the spectators on
the hill. Voices rose above the hum, louder than peaceful voices ever rise.
The triumph was a popular triumph, and like every other such, had its
attendant mob of mischief. Shouts of rising clamor and a noise of rushing
footsteps ran through the busy streets—then came a sharp rattle and peal
like a discharge of musketry. What was it? The crowd on the hill poured
down the descent, in fright, in excitement, in precaution—some into the
mischief, some eager to escape out of it. “It’s the sodgers,” “it’s the police,”
“it’s the Tories,” shouted the chorus of the crowd—one suggestion after
another raising the fury of some and the terror of others; again a rattling,
dropping, continued report—one after another, with rushes of the crowd
between, and perpetual changes of locality in the sound, which at last
indicated its nature beyond mistake. It was no interference of authority—no
firing of “the sodgers.” It was a sound less tragic, yet full of mischief—the
crash of unilluminated windows, the bloodless yet violent revenge of the
excited mob.
The sound—the swell—the clamor—the tramp of feet—the shouts—the
reiterated volleys, now here, now there, in constant change and progress,
the silent flicker and glow of the now neglected lights, the hasty new ones
thrust into exposed windows, telling their story of sudden alarm and
reluctance, and above all the pale, serene sky, against which the bold outline
of Arthur’s Seat stood out as clear as in the daylight, and the calm,
unimpassioned shining of the little moon, catching the windows of the
Castle and church beneath with a glimmer of silver, made altogether a scene
of the most singular excitement and impressiveness. But Cosmo
Livingstone had forgotten that he was a poet—he was only a boy—a
desperate, red-hot Radical—a friend of the people. Despite all Cameron’s
efforts, the boy dragged him into the crowd, and hurried him along to the
scene of action. The rioters by this time were spreading everywhere, out of
the greater streets into the calm of the highest respectability, where not one
window in a dozen was lighted, and where many had closed their shutters in
defiance—far to the west in the moonlight, where the illuminations of the
old town were invisible, and where wealth and conservatism dwelt together.
Breathless, yet dragging his grave companion after him, Cosmo rushed
along one of the dimmest and stateliest of these streets. The lad leaped back
again into the heart of a momentary fancy, which was already old and
forgotten, though it had been extremely interesting a month ago. He cried
“Desirée!” to himself, as he rushed in the wake of the rioters through Moray
Place. He did not know which was the house, yet followed vaguely with an
instinct of defense and protection. In one of the houses some women
appeared, timidly putting forward candles in the highest line of windows;
perhaps out of exasperation at this cowardice, perhaps from mere accident,
some one among the crowd discharged a volley of stones against one of the
lower range. There was a moment’s pause, and it remained doubtful
whether this lead was to be followed, when suddenly the door of the house
was thrown open, and a girl appeared upon the threshold, distinctly visible
against the strong light from the hall. Though Cosmo sprang forward with a
bound, he could not hear what she said, but she rushed down on the broad
step, and made a vehement address to the rioters, with lively motions of her
hands, and a voice that pierced through their rough voices like a note of
music. This lasted only a moment; in another the door had closed behind
her with a loud echo, and all was dark again. Where was she? Cosmo
pushed through the crowd in violent excitement, thrusting them away on
every side with double strength. Yes, there she stood upon the step,
indignant, vehement, with her little white hands clasped together, and her
eyes flashing, from the rioters before her to the closed door behind.
“You English!—you are cowards!” cried the violent little heroine; “you
do not fight like men, with balls and swords—you throw pebbles, like
children—you wound women—and when one dares to go to speak to the
madmen, she is shut out into the crowd!”
“We’re no’ English, missie, and naebody meant to hurt you; chap at the
door for her, yin o’ you lads—and let the poor thing alone—she’s a very
good spirit of her ain. I’m saying, open the door,” cried one of the rioters,
changing his soothing tone to a loud demand, as he shook the closed door
violently. By this time Cosmo was by the little Frenchwoman’s side.
“I know her,” cried Cosmo, “they’ll open when you’re past—pass on—
it’s a school—a housefull of women—do you mean to say you would break
a lady’s windows that has nothing to do with it?—pass on!—is that sense,
or honor, or courage? is that a credit to the Bill, or to the country? I’ll take
care of the young lady. Do you not see they think you robbers, or worse?
They’ll not open till you pass on.”
“He’s in the right of it there—what are ye a’ waiting for?” cried some
one in advance. The throng moved on, leaving a single group about the
door, but this little incident was enough to damp them. Moray Place
escaped with much less sacrifice of glass and temper than might have been
looked for—while poor little Desirée, subsiding out of her passion, leaned
against the pillar of the inhospitable door, crying bitterly, and sobbing little
exclamations of despair in her own tongue, which sounded sweet to
Cosmo’s ear, though he did not know what they were.
“Mademoiselle Desirée, don’t be afraid,” cried the boy, blushing in the
dark. “I saw you once with Joanna Huntley—I’m a friend. Nobody will
meddle with you. When they see these fellows gone, they’ll open the door.”
“And I despise them!” cried Desirée, suddenly suspending her crying;
“they will shut me out in the crowd for fear of themselves. I despise them!
and see here!”
A stone had struck her on the temple; it was no great wound, but Desirée
was shocked and excited, and in a heroic mood.
“And they will leave me here,” cried the little Frenchwoman,
pathetically, with renewed tears; “though it is my mother’s country, and I
meant to love it, they shut me out among strangers, and no one cares. Ah,
they would not do so in France! there they do not throw stones at women—
they kill men!”
Cosmo was horrified by the blow, and deeply impressed by the heroics.
The boy blushed with the utmost shame for his townsmen and co-
politicians. He thought the girl a little Joan of Arc affronted by a mob.
“But it was accident; and every man would be overpowered with
shame,” cried Cosmo, while meanwhile Cameron, who had followed him,
knocked soberly and without speaking, at the door.
After a little interval, the door was opened by the mistress of the school,
a lady of grave age and still graver looks; a couple of women-servants in
the hall were defending themselves eagerly.
“I was up stairs, and never heard a word of it, mum,” said one. “Eh, it
wasna me!” cried another; “the French Miss flew out upon the steps, and
the door just clashed behind her; it was naebody’s blame but her ain.”
In the midst of these self-exculpatory addresses, the mistress of the
house held the door open.
“Come in, Mademoiselle Desirée,” she said gravely.
The excited little Frenchwoman was not disposed to yield so quietly.
“Madame, I have been wounded, I have been shut out, I have been left
alone in the crowd!” cried Desirée; “I demand of you to do me justice—see,
I bleed! One of the vauriens struck me through the window with a stone,
and the door has been closed upon me. I have stood before all the crowd
alone!”
“I am sorry for it, my dear,” said the lady, coldly; “come in—you ought
never to have gone to the door, or exposed yourself; young ladies do not do
so in this country. Pray come in, Mademoiselle Desirée. I am sorry you are
hurt—and, gentlemen, we are much obliged to you—good night.”
For the girl, half-reluctantly, half-indignantly, had obeyed her superior,
and the door was calmly closed in the faces of Cosmo and Cameron, who
stood together on the steps. Cosmo was highly incensed and wrathful. He
could have had the heart to plunge into that cold, proper, lighted hall, to
snatch the little heroine forth, and carry her off like a knight of romance.
“Do you hear how that woman speaks to her?” he cried, indignantly.
Cameron grasped his arm and drew him away.
“She’s French!” said the elder man, laconically, and without any
enthusiasm; “and not to anger you, Cosmo, the lady is perfectly right.”
CHAPTER XXXVIII.
Cosmo went home that evening much excited by his night’s adventures.
Mrs. Payne, of Moray Place, was an ogre in the boy’s eyes, the Giantess
Despair, holding bewitched princesses in vile durance and subjection—and
Desirée, with the red mark upon her pretty forehead, with her little white
hands clasped together, and her black eyes sparkling, was nothing less than
a heroine. Cosmo could not forget the pretty attitude, the face glowing with
resentment and girlish boldness; nor the cold gravity of the voice which
bade her enter, and the unsympathetic disapproval in the lady’s face. He
could not rest for thinking of it when he got home. In his new feeling of
importance and influence as a person privileged to address the public, his
first idea was to call upon Mrs. Payne in the morning, by way of protector
to Desirée, to explain how the whole matter occurred; but on further
thoughts Cosmo resolved to write a very grave and serious letter on the
subject, vindicating the girl, and pointing out, in a benevolent way, the
danger of repressing her high spirit harshly.
As soon as he was alone, he set about carrying out this idea in an epistle
worthy the pages of the Auld Reekie Magazine, and written with a solemn
authority which would have become an adviser of eighty instead of
eighteen. He wrote it out in his best hand, put it up carefully, and resolved
to leave it himself in the morning, lest the post (letters were dear in those
days) might miscarry with so important a document. But Cosmo, who was
much worn out, slept late in the morning, so late that Cameron came into
his room, and saw the letter before he was up. It excited the curiosity of the
Highlander, and Cosmo, somewhat shyly, admitted him to the privilege of
reading it. It proved too much, however, for the gravity of his friend; and,
vexed and ashamed at last, though by no means convinced the lad tore it in
bits, and threw it into the fire-place. Cameron kept him occupied all day,
breaking out, nevertheless, into secret chuckles of amusement now and
then, which it was very difficult to find a due occasion for; and Cosmo was
not even left to himself long enough to pass the door of the house in Moray
Place, or to ask after the “wound” of his little heroine. He did the only thing
which remained possible to him, he made the incident into a copy of verses,
which he sent to the North British Courant, and which duly appeared in that
enlightened newspaper—though whether it ever reached the eyes of
Desirée, or touched the conscience of the schoolmistress by those allusions
which, though delicately vailed, were still, Cosmo flattered himself,
perfectly unmistakable by the chief actors in the scene, the boy could not
tell.
These days of holiday flew, however, as holidays will fly. Cameron’s
Highland patron had Cosmo introduced to him, and consented that his son
should travel in the company of the son of “Mrs. Livingstone, of Norlaw,”
and the lad went home, full of plans for his journey, to which the Mistress
as yet had given only a very vague and general consent, and of which she
scarcely still understood the necessity. When Cosmo came home, he had the
mid-chamber allotted to him as a study, and went to work with devotion.
The difficulty was rather how to choose between the narrative in ballad
verse, the spirited dramatic sketch, and the historical tale, than how to
execute them, for Cosmo had that facility of language, and even of idea,
which many very youthful people, with a “literary turn,” (they were very
much less common in those days) often possess, to the half-amusement,
half-admiration of their seniors and their own intense confusion in maturer
days. Literature was not then what it is now, the common resource of most
well-educated young men, who do not know what else to do with
themselves. It was still a rare glory in that rural district where the mantle of
Sir Walter lay only over the great novelist’s grave, and had descended upon
nobody’s shoulders; and as Cosmo went on with his venture, the Mistress,
glowing with mother-pride and ambition, hearing the little bits of the
“sketch"—eighteen is always dramatical—which seemed, to her loving
ears, melodious, and noble, and life-like, almost above comparison, became
perfectly willing to consent to any thing which was likely to perfect this gift
of magic. “Though I canna weel see what better they could have,” she said
to herself, as she went down from Cosmo’s study, wiping her eyes. Cosmo’s
muse had sprung, fully equipped, like Minerva, into a glorious existence—
at least, so his mother, and so, too, if he had permitted himself to know his
own sentiments—perhaps also Cosmo thought.
The arrangement was concluded, at last, on the completion of Cosmo’s
article. Cameron and his young pupil were to start in August; and the
Mistress herself went into Edinburgh to buy her boy-author the handiest of
portmanteaus, and every thing else which her limited experience thought
needful for him; the whole country-side heard of his intended travels, and
was stirred with wonder and no small amount of derision. The farmers’
wives wondered what the world was coming to, and their husbands shook
their heads over the folly of the widow, who would ruin her son for work all
his days. The news was soon carried to Melmar, where Mr. Huntley by no
means liked to hear it, where Patricia turned up her little nose with disgust,
and where Joanna wished loudly that she was going too, and announced her
determination to intrust Cosmo with a letter to Oswald. Even in the manse,
the intelligence created a little ferment. Dr. Logan connected it vaguely—he
could not quite tell how—with the “Bill,” which the excellent minister
feared would revolutionize every thing throughout the country, and
confound all the ranks and degrees of social life; and shook his head over
the idea of Cosmo Livingstone, who had only been one session at college,
and was but eighteen, writing in a magazine.
“Depend upon it, Katie, my dear, it’s an unnatural state of things,” said
the Doctor, whose literature was the literature of the previous century, and
who thought Cosmo’s pretensions unsafe for the stability of the country.
And sensible Katie, though she smiled, felt still a little doubtful herself,
and, in her secret heart, thought of Huntley gone away to labor at the other
end of the world, while his boy-brother tasted the sweets of luxury and
idleness in an indulgence so unusual to his station.
“Poor Huntley!” said Katie to herself, with a gentle recollection of that
last scene in the manse parlor, when she mended her children’s stockings
and smiled at the young emigrant, as he wondered what changes there
might be there when he came back. Katie put up her hand very softly to her
eyes, and stood a long time in the garden looking down the brae into the
village—perhaps only looking at little Colin, who was visible amid some
cottage boys on the green bank of Tyne—perhaps thinking of Cosmo, who
was going “to the Continent,"—perhaps traveling still further in her
thoughts, over a big solitary sea; but Katie said “nothing to nobody,” and
was as blythe and busy in the manse parlor when the minister rejoined her,
as though she had not entered with a little sigh.
All this time Cosmo never said a word to his mother of Mary of Melmar;
but he leaped up into the old window of the castle every evening to dream
his dream, and a hundred times, in fancy, saw a visionary figure, pale, and
lovely, and tender, coming home with him to claim her own. He, too,
looked over the woods of Melmar as his brother had done, but with feelings
very different—for no impulse of acquisition quickened in the breast of
Cosmo. He thought of them as the burden of a romance, the chorus of a
ballad—the inheritance to which the long lost Mary must return; and while
the Mistress stocked his new portmanteau, and made ready his traveling
wardrobe, the lad was hunting everywhere with ungrateful pertinacity for
scraps of information to guide him in this search which his mother had not
the most distant idea was the real motive of his journey. If she had known it,
scarcely even the discovery of her husband’s longing after his lost love
could have affected the Mistress with more overpowering bitterness and
disgust. Marget shut the door when Cosmo came to question her on the
subject, and made a vehement address to him under her breath.
“Seek her, if you please,” said Marget, in a violent whisper; “but if your
mother ever kens this—sending out her son into the world with a’ this pride
and pains for her sake—I’d rather the auld castle fell on our heads, Cosmo
Livingstone, and crushed every ane of us under a different stane!”
“Hush, Marget! my mother is not unjust,” said Cosmo, with some
displeasure.
“She’s no’ unjust; but she’ll no’ be second to a stranger woman that has
been the vexation of her life,” said Marget, “spier where you like, laddie. Ye
dinna ken, the like of you, how things sink into folks’ hearts, and bide for
years. I ken naething about Mary of Melmar—neither her married name nor
naught else—spier where ye like, but dinna spier at me.”
But it did not make very much matter where Cosmo made inquiry. Never
was disappearance more entire and complete than that of Mary of Melmar.
He gathered various vague descriptions of her, not quite so poetical in
sentiment as Jaacob’s, but quite as confusing. She was “a great toast among
a’ the lads, and the bonniest woman in the country-side"—she was “as
sweet as a May morning"—she was “neither big nor little, but just the best
woman’s size"—she was, in short, every thing that was pretty, indefinite,
and perplexing. And with no clue but this, Cosmo set out, on a windy
August morning, on his travels, to improve his mind, and write for the Auld
Reekie Magazine, as his mother thought—and to seek for the lost heir of the
Huntleys, as he himself and the Laird of Melmar knew.
CHAPTER XXXIX.
“Oh, papa,” cried Joanna Huntley, bursting into Melmar’s study like a
whirlwind, “they’re ill-using Desirée! they shut her out at the door among a
crowd, and they threw stones at her, and she might have been killed but for
Cosmo Livingstone. I’ll no’ stand it! I’ll rather go and take up a school and
work for her mysel’.”
“What’s all this?” said Melmar, looking up in amazement from his
newspaper; “another freak about this Frenchwoman—what is she to you?”
“She’s my friend,” said Joanna, “I never had a friend before, and I never
want to have another. You never saw anybody like her in all your life;
Melmar’s no’ good enough for her, if she could get it for her very own—but
I think she would come here for me.”
“That would be kind,” said Mr. Huntley, taking a somewhat noisy pinch
of snuff; “but if that’s all you have to tell me, it’ll keep. Go away and bother
your mother; I’m busy to-day.”
“You know perfectly well that mamma’s no’ up,” said Joanna, “and if
she was up, what’s the use of bothering her? Now, papa, I’ll tell you—I
often think you’re a very, very ill man—and Patricia says you have a secret,
and I know what keeps Oswald year after year away—but I’ll forgive you
every thing if you’ll send for Desirée here.”
“You little monkey!” cried Melmar, swinging his arm through the air
with a menaced blow. It did not fall on Joanna’s cheek, however, and
perhaps was not meant to fall—which was all the better for the peace of the
household—though feelings of honor or delicacy were not so
transcendentally high in Melmar as to have made a parental chastisement a
deadly affront to the young lady, even had it been inflicted. “You little
brat!” repeated the incensed papa, growing red in the face, “how dare you
come to me with such a speech—how dare you bother me with a couple of
fools like Oswald and Patricia?—begone this moment, or I’ll—” “No, you
will not, papa,” interrupted Joanna. “Oswald’s no’ a fool—and I’m no’ a
monkey nor a brat, nor little either—and if any thing was to happen I would
never forsake you, whatever you had done—but I like Desirée better than
ever I liked any one—and she knows every thing—and she could teach me
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like