DOM Scripting Web Design with JavaScript and the
Document Object Model Second Edition Jeremy Keith -
PDF Download (2025)
https://ebookultra.com/download/dom-scripting-web-design-with-
javascript-and-the-document-object-model-second-edition-jeremy-
keith/
Visit ebookultra.com today to download the complete set of
ebooks or textbooks
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookultra.com
to discover even more!
DOM Scripting Web Design with JavaScript and the Document
Object Model 2nd Edition Jeremy Keith
https://ebookultra.com/download/dom-scripting-web-design-with-
javascript-and-the-document-object-model-2nd-edition-jeremy-keith/
Practical JavaScript DOM Scripting and Ajax Projects 1st
Edition Frank Zammetti
https://ebookultra.com/download/practical-javascript-dom-scripting-
and-ajax-projects-1st-edition-frank-zammetti/
DHTML Utopia Modern Web Design Using JavaScript DOM 1st
edition Edition Stuart Langridge
https://ebookultra.com/download/dhtml-utopia-modern-web-design-using-
javascript-dom-1st-edition-edition-stuart-langridge/
Document Object Model Processing Structured Documents 1st
Edition Joe Marini
https://ebookultra.com/download/document-object-model-processing-
structured-documents-1st-edition-joe-marini/
Scripting in Java Integrating with Groovy and JavaScript
1st Edition Kishori Sharan
https://ebookultra.com/download/scripting-in-java-integrating-with-
groovy-and-javascript-1st-edition-kishori-sharan/
Web Design Digital Classroom 1st Edition Jeremy Osborn
https://ebookultra.com/download/web-design-digital-classroom-1st-
edition-jeremy-osborn/
Beginning JavaScript 5th Edition Jeremy Mcpeak
https://ebookultra.com/download/beginning-javascript-5th-edition-
jeremy-mcpeak/
Object Oriented Design with UML and Java 1st Edition
Kenneth Barclay
https://ebookultra.com/download/object-oriented-design-with-uml-and-
java-1st-edition-kenneth-barclay/
Web Development with Node and Express Leveraging the
JavaScript Stack 1st Edition Ethan Brown
https://ebookultra.com/download/web-development-with-node-and-express-
leveraging-the-javascript-stack-1st-edition-ethan-brown/
DOM Scripting Web Design with JavaScript and the
Document Object Model Second Edition Jeremy Keith
Digital Instant Download
Author(s): Jeremy Keith, Jeffrey Sambells
ISBN(s): 9781430233893, 1430233893
Edition: 2
File Details: PDF, 6.29 MB
Year: 2010
Language: english
Second
Edition
DOM SCRIPTING
DOM Scripting
Web Design with JavaScript and the
Document Object Model
Second Edition
■■■
Jeremy Keith
with Jeffrey Sambells
i
DOM Scripting: Web Design with JavaScript and the Document Object Model: Second Edition
Copyright © 2010 by Jeremy Keith with Jeffrey Sambells
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-13 (pbk): 978-1-4302-3389-3
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
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.
Publisher and President: Paul Manning
Lead Editor: Ben Renow-Clarke
Technical Reviewer: Rob Drimmie
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 Editors: Candace English
Copy Editor: Jim Compton and Marilyn Smith
Compositor: MacPS, LLC
Indexer: Toma Mulligan
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.
ii
For Jessica, my wordridden wife
—Jeremy
For Stephanie, Addison, and Hayden, always by my side
—Jeffrey
iii
Contents at a Glance
■Contents ................................................................................................................ v
■About the Authors .............................................................................................. xiii
■About the Technical Reviewer............................................................................ xiv
■Acknowledgments............................................................................................... xv
■Introduction ....................................................................................................... xvi
■Chapter 1: A Brief History of JavaScript ............................................................... 1
■Chapter 2: JavaScript Syntax ................................................................................ 7
■Chapter 3: The Document Object Model .............................................................. 31
■Chapter 4: A JavaScript Image Gallery ............................................................... 45
■Chapter 5: Best Practices .................................................................................... 59
■Chapter 6: The Image Gallery Revisited .............................................................. 73
■Chapter 7: Creating Markup on the Fly ............................................................... 95
■Chapter 8: Enhancing Content ........................................................................... 123
■Chapter 9: CSS-DOM .......................................................................................... 149
■Chapter 10: An Animated Slideshow ................................................................. 175
■Chapter 11: HTML5 ............................................................................................ 205
■Chapter 12: Putting It All Together.................................................................... 227
■Appendix: DOM Scripting Libraries ................................................................... 279
■Index ................................................................................................................. 303
iv
Contents
■Contents at a Glance ............................................................................................ iv
■About the Authors .............................................................................................. xiii
■About the Technical Reviewer............................................................................ xiv
■Acknowledgments............................................................................................... xv
■Introduction........................................................................................................ xvi
■Chapter 1: A Brief History of JavaScript ............................................................... 1
The origins of JavaScript ................................................................................................ 1
The Document Object Model ........................................................................................... 2
The browser wars ........................................................................................................... 3
The D word: DHTML ............................................................................................................................... 3
Clash of the browsers ............................................................................................................................ 3
Raising the standard ....................................................................................................... 4
Thinking outside the browser ................................................................................................................ 4
The end of the browser wars ................................................................................................................. 4
A new beginning .................................................................................................................................... 5
What’s next? ................................................................................................................... 5
■Chapter 2: JavaScript Syntax ................................................................................ 7
What you’ll need ............................................................................................................. 7
Syntax ............................................................................................................................. 9
Statements ............................................................................................................................................. 9
Comments ............................................................................................................................................ 10
Variables .............................................................................................................................................. 10
v
■ CONTENTS
Data types ............................................................................................................................................ 12
Arrays ................................................................................................................................................... 14
Objects ................................................................................................................................................. 16
Operations ..................................................................................................................... 17
Arithmetic operators ............................................................................................................................ 17
Conditional statements ................................................................................................. 19
Comparison operators .......................................................................................................................... 20
Logical operators ................................................................................................................................. 21
Looping statements ...................................................................................................... 22
The while loop ...................................................................................................................................... 22
The for loop .......................................................................................................................................... 24
Functions ...................................................................................................................... 24
Objects .......................................................................................................................... 27
Native objects ...................................................................................................................................... 28
Host objects ......................................................................................................................................... 29
What’s next? ................................................................................................................. 29
■Chapter 3: The Document Object Model .............................................................. 31
D is for document.......................................................................................................... 31
Objects of desire ........................................................................................................... 31
Dial M for model............................................................................................................ 32
Nodes ............................................................................................................................ 33
Element nodes ..................................................................................................................................... 34
Text nodes............................................................................................................................................ 34
Attribute nodes..................................................................................................................................... 34
Cascading Style Sheets........................................................................................................................ 35
Getting Elements .................................................................................................................................. 37
Taking stock ......................................................................................................................................... 41
Getting and Setting Attributes ....................................................................................... 41
getAttribute .......................................................................................................................................... 41
vi
■ CONTENTS
setAttribute .......................................................................................................................................... 43
What’s next? ................................................................................................................. 44
■Chapter 4: A JavaScript Image Gallery ............................................................... 45
The markup ................................................................................................................... 45
The JavaScript .............................................................................................................. 47
A DOM diversion ................................................................................................................................... 48
Finishing the function .......................................................................................................................... 49
Applying the JavaScript ................................................................................................ 49
Event handlers ..................................................................................................................................... 49
Expanding the function ................................................................................................. 51
Introducing childNodes ........................................................................................................................ 51
Introducing the nodeType property ...................................................................................................... 52
Adding a description in the markup ..................................................................................................... 53
Changing the description with JavaScript ........................................................................................... 54
Introducing the nodeValue property ..................................................................................................... 54
Introducing firstChild and lastChild ...................................................................................................... 55
Using nodeValue to update the description ......................................................................................... 55
What’s next? ................................................................................................................. 58
■Chapter 5: Best Practices .................................................................................... 59
Mistakes of the past ..................................................................................................... 59
Don’t blame the messenger ................................................................................................................. 59
The Flash mob...................................................................................................................................... 60
Question everything ............................................................................................................................. 60
Graceful degradation .................................................................................................... 61
The javascript: pseudo-protocol .......................................................................................................... 62
Inline event handlers ............................................................................................................................ 62
Who cares? .......................................................................................................................................... 63
The lessons of CSS ....................................................................................................... 63
Separation of structure and style ......................................................................................................... 63
vii
■ CONTENTS
Progressive enhancement ................................................................................................................... 64
Unobtrusive JavaScript ................................................................................................. 65
Backward compatibility ................................................................................................ 67
Object detection ................................................................................................................................... 67
Browser sniffing ................................................................................................................................... 68
Performance considerations ......................................................................................... 69
Minimizing DOM access and markup................................................................................................... 69
Assembling and placing scripts ........................................................................................................... 70
Minification .......................................................................................................................................... 70
What’s next? ................................................................................................................. 71
■Chapter 6: The Image Gallery Revisited .............................................................. 73
A quick recap ................................................................................................................ 73
Does it degrade gracefully? .......................................................................................... 74
Is the JavaScript unobtrusive? ..................................................................................... 75
Adding the event handler ..................................................................................................................... 75
Share the load ...................................................................................................................................... 80
Assuming too much ...................................................................................................... 82
Fine-tuning.................................................................................................................... 84
Keyboard access ........................................................................................................... 86
Beware of onkeypress ......................................................................................................................... 87
Sharing hooks with CSS................................................................................................ 88
DOM Core and HTML-DOM ............................................................................................ 91
What’s next? ................................................................................................................. 92
■Chapter 7: Creating Markup on the Fly ............................................................... 95
Some old-school methods ............................................................................................ 95
document.write .................................................................................................................................... 95
innerHTML ............................................................................................................................................ 97
DOM methods ............................................................................................................. 100
createElement .................................................................................................................................... 101
viii
■ CONTENTS
appendChild ....................................................................................................................................... 102
createTextNode .................................................................................................................................. 103
A more complex combination ............................................................................................................ 105
Revisiting the image gallery ....................................................................................... 107
Inserting a new element before an existing one ................................................................................ 109
Inserting a new element after an existing one................................................................................... 110
The finished image gallery ................................................................................................................. 112
Ajax ............................................................................................................................. 116
The XMLHttpRequest object ............................................................................................................... 116
Progressive enhancement with Ajax .................................................................................................. 121
Hijax ................................................................................................................................................... 121
What’s next? ............................................................................................................... 122
■Chapter 8: Enhancing Content ........................................................................... 123
What not to do............................................................................................................. 123
Making the invisible visible......................................................................................... 124
The content ................................................................................................................. 124
The markup: HTML, XHTML, or HTML5 .............................................................................................. 125
The CSS .............................................................................................................................................. 127
The JavaScript ................................................................................................................................... 128
Displaying abbreviations ............................................................................................. 128
Writing the displayAbbreviations function ......................................................................................... 129
Creating the markup .......................................................................................................................... 131
A browser bomb ................................................................................................................................. 136
Displaying citations ..................................................................................................... 139
Writing the displayCitations function ................................................................................................. 140
Displaying access keys ............................................................................................... 145
Retrieving and attaching information ......................................................................... 148
What’s next? ............................................................................................................... 148
ix
■ CONTENTS
■Chapter 9: CSS-DOM ......................................................................................... 149
Three sheets to the Web . ............................................................................................149
Structure .............................................................................................................................................. 149
Presentation ......................................................................................................................................... 150
Behavior . .............................................................................................................................................. 150
Separation ............................................................................................................................................ 151
The style property ....................................................................................................... 152
Getting styles ....................................................................................................................................... 153
Setting styles ....................................................................................................................................... 158
Knowing when to use DOM styling . ........................................................................... 160
Styling elements in the node tree . ...................................................................................................... 160
Repetitive styling ................................................................................................................................. 164
Responding to events........................................................................................................................... 168
className . ................................................................................................................ 170
Abstracting a function .......................................................................................................................... 173
What’s next? . ............................................................................................................. 174
■Chapter 10: An Animated Slideshow ................................................................ 175
Animation basics ........................................................................................................175
Position . ............................................................................................................................................... 175
Time . .................................................................................................................................................... 178
Incremental movement ........................................................................................................................ 178
Abstraction ........................................................................................................................................... 181
Practical animation . ................................................................................................... 187
The situation ........................................................................................................................................ 188
The solution ......................................................................................................................................... 189
CSS. ...................................................................................................................................................... 190
JavaScript ............................................................................................................................................ 192
A question of scope.............................................................................................................................. 195
Refining the animation ......................................................................................................................... 197
Adding a safety check .......................................................................................................................... 200
x
■ CONTENTS
Generating markup ............................................................................................................................ 201
What’s next? ............................................................................................................... 204
■Chapter 11: HTML5 ............................................................................................ 205
What is HTML5? .......................................................................................................... 205
A little help from a friend ............................................................................................ 206
A few examples .......................................................................................................... 208
Canvas ............................................................................................................................................... 208
Audio/Video ........................................................................................................................................ 213
Forms ................................................................................................................................................. 221
Is there anything else?................................................................................................ 225
What's Next ................................................................................................................. 226
■Chapter 12: Putting It All Together.................................................................... 227
The brief ...................................................................................................................... 227
Raw materials .................................................................................................................................... 227
Site structure ..................................................................................................................................... 227
Page structure.................................................................................................................................... 229
Design ......................................................................................................................... 229
CSS ............................................................................................................................. 230
Color ................................................................................................................................................... 232
Layout ................................................................................................................................................ 234
Typography ........................................................................................................................................ 236
Markup ........................................................................................................................ 238
JavaScript ................................................................................................................... 238
Page highlighting ............................................................................................................................... 240
JavaScript slideshow ......................................................................................................................... 243
Internal navigation ............................................................................................................................. 248
JavaScript image gallery ................................................................................................................... 252
Table enhancements .......................................................................................................................... 256
Form enhancements .......................................................................................................................... 261
xi
■ CONTENTS
Minification ........................................................................................................................................ 276
What’s next? ............................................................................................................... 277
■Appendix: DOM Scripting Libraries ................................................................... 279
Choosing a library ....................................................................................................... 280
A few libraries .................................................................................................................................... 281
Content delivery networks ................................................................................................................. 282
Syntax ......................................................................................................................... 283
Selecting elements ..................................................................................................... 284
CSS selectors ..................................................................................................................................... 284
Library-specific selectors .................................................................................................................. 286
Filtering with a callback ..................................................................................................................... 288
Manipulating the DOM document ............................................................................... 289
Creating content................................................................................................................................. 289
Manipulating content ......................................................................................................................... 291
Handling events .......................................................................................................... 291
Load events ........................................................................................................................................ 291
Other events ....................................................................................................................................... 292
Ajax ............................................................................................................................. 293
Ajax with Prototype ............................................................................................................................ 293
Ajax with jQuery ................................................................................................................................. 296
Animation and effects ................................................................................................. 298
CSS property-based animations ........................................................................................................ 299
Packaged animations ......................................................................................................................... 300
Remember accessibility ..................................................................................................................... 301
Summary..................................................................................................................... 301
■Index ................................................................................................................. 303
xii
About the Authors
■ Jeremy Keith is a web developer living and working in Brighton, England. Working with the web
consultancy firm Clearleft (www.clearleft.com), Jeremy enjoys building accessible, elegant websites
using the troika of web standards: XHTML, CSS, and the DOM. His online home is http://adactio.com.
Jeremy is also a member of the Web Standards Project (www.webstandards.org), where he serves as joint
leader of the DOM Scripting Task Force. When he is not building websites, Jeremy plays bouzouki in the
alt.country band Salter Cane (www.saltercane.com). He is also the creator and curator of one of the Web’s
largest online communities dedicated to Irish traditional music, The Session (www.thesession.org).
■ Jeffrey Sambells is a Canadian designer of pristine pixel layouts and a developer of squeaky clean
code. Back in the good-old days of the Internet, he started a little company called We-Create. Today, he
is still there as Director of Research and Development / Mobile. The title “Director of R&D” may sound
flashy, but really, that just means he is in charge of learning and cramming as much goodness into
products as possible—ensuring they’re all just awesome. He is currently having fun exploring mobile
design and development techniques. Jeffrey loves to learn. He has as much enthusiasm for digging in the
dirt or climbing a cliff as he does for precisely aligning pixels or forcing that page to load just a little
faster. What really pushes him forward is taking the bits of knowledge he has collected and piecing them
together into something new and unique—something other people can be excited about, too. Along the
way, Jeffrey has managed to graduate university, start a few businesses, write some books, and raise a
wonderful family.
xiii
■ CONTENTS
About the Technical Reviewer
■ Rob Drimmie is lucky. He has an amazing wife, two awesome kids, and a brand-new keyboard. Rob's
creative urges tend to manifest in the form of web applications, and he prefers they be fueled by pho and
hamburgers (the creative urges, that is).
xiv
Acknowledgments
This book owes its existence to my friends and colleagues, Andy Budd (http://andybudd.com) and
Richard Rutter (http://clagnut.com). Andy runs a (free) training event in our hometown of Brighton
called Skillswap (http://www.skillswap.org). Way back in July 2004, Richard and I gave a joint
presentation on JavaScript and the Document Object Model. Afterward, we adjourned to the cozy
confines of a nearby pub, where Andy put the idea in my head of expanding the talk into the first edition
of this book.
I would never have learned to write a single line of JavaScript if it weren’t for two things. The first is the
view source option built in to almost every web browser. Thank you, view source. The second is the
existence of JavaScript giants who have been creating amazing code and explaining important ideas over
the years. Scott Andrew, Aaron Boodman, Steve Champeon, Peter-Paul Koch, Stuart Langridge, and
Simon Willison are just some of the names that spring to mind. Thank you all for sharing.
Thanks to Molly Holzschlag for sharing her experience and advice with me, and for giving me feedback
on early drafts. Thanks to Derek Featherstone for many a pleasurable JavaScriptladen chat; I like the way
your mind works.
Extra-special thanks to Aaron Gustafson who provided invaluable feedback and inspiration during the
writing of this book.
While I was writing the first edition of this book, I had the pleasure of speaking at two wonderful events:
South by Southwest in Austin, Texas, and @media in London. Thanks to Hugh Forrest and Patrick
Griffiths, respectively, for orchestrating these festivals of geekery that allowed me to meet and befriend
the nicest, friendliest bunch of people I could ever hope to call my peers.
Finally, I’d like to thank my wife, Jessica Spengler, not only for her constant support, but also for her
professional help in proofreading my first drafts. Go raibh míle maith agat, a stór mo chroí.
Jeremy Keith
xv
■ CONTENTS
Introduction
This book deals with a programming language, but it isn’t intended for programmers. This is a book for
web designers. Specifically, this book is intended for standards-aware designers who are comfortable
using CSS and HTML. If that sounds like you, read on.
This book is made up of equal parts code and concepts. Don’t be frightened by the code. I know it
might look intimidating at first, but once you’ve grasped the concepts behind the code, you’ll find
yourself reading and writing in a new language.
Learning a programming language might seem like a scary prospect, but it needn’t be. Document
Object Model (DOM) scripting might appear to be more verbose than, say, CSS. But once you have the
hang of the syntax, you’ll find yourself armed with a powerful web development tool. In any case, the
code is there simply to illustrate the concepts.
I’ll let you in on a secret: no one memorizes all the syntax and keywords that are part and parcel of
any programming language. That’s what reference books are for. This isn’t a reference book. I’m going to
cover the bare minimum of syntax required to get up and running with JavaScript.
In this book, I focus on the ideas behind DOM scripting. A lot of these ideas might already be
familiar to you. Graceful degradation, progressive enhancement, and user-centered design are
important concepts in any aspect of front-end web development. These ideas inform all the code
examples given in this book.
You’ll find scripts for creating image galleries, animating slideshows, and enhancing the look and
feel of page elements. If you want, you can simply cut and paste these examples, but it’s more important
to understand the hows and whys that lie behind the code.
If you’re already using CSS and HTML to turn your designs into working web pages, then you
already know how powerful web standards can be. Remember when you discovered that you could
change the design throughout an entire site just by changing one CSS file? The DOM offers an equal level
of power. But with great power comes great responsibility. That’s why I’m not just going to show you
cool DOM scripting effects. I’m also going to show you how to use DOM scripting to enhance your web
pages in a usable, accessible way.
To get all the code examples discussed in the book, pay a visit to www.friendsofed.com and find this
book’s page. At the friends of ED site, you can also find out about all the other great books the publisher
has to offer on web standards, Flash, Dreamweaver, and much more besides.
Your exploration of DOM scripting needn’t end when you close this book. I’ve set up a website at
http://domscripting.com/, where I continue the discussion of modern, standards-based JavaScript. I
hope you’ll pay the site a visit. In the meantime, enjoy the book.
xvi
CHAPTER 1
■■■
A Brief History of JavaScript
What this chapter covers:
• The origins of JavaScript
• The browser wars
• The evolution of the DOM
When the first edition of this book was published in 2005, it was an exciting time to be a web
designer. Thankfully, five years later, it still is. This is especially true for JavaScript, which has been
pulled from the shadows and into the spotlight. Web development has evolved from its chaotic,
haphazard roots into a mature discipline. Designers and developers are adopting a standards-based
approach to building websites, and the term web standards has been coined to describe the technologies
that enable this approach.
Whenever designers discuss the subject of web standards, Hypertext Markup Language (HTML) and
Cascading Style Sheets (CSS) usually take center stage. However, a third technology has been approved
by the World Wide Web Consortium (W3C) and is supported by all standards-compliant web browsers.
This is the Document Object Model (DOM), which allows us to add interactivity to our documents in
much the same way that CSS allow us to add styles.
Before looking at the DOM, let’s examine the language that you’ll be using to make your web pages
interactive. The language is JavaScript, and it has been around for quite some time.
The origins of JavaScript
JavaScript was developed by Netscape, in collaboration with Sun Microsystems. Before JavaScript, web
browsers were fairly basic pieces of software capable of displaying hypertext documents. JavaScript was
later introduced to add some extra spice to web pages and to make them more interactive. The first
version, JavaScript 1.0, debuted in Netscape Navigator 2 in 1995.
At the time of JavaScript 1.0’s release, Netscape Navigator dominated the browser market. Microsoft
was struggling to catch up with its own browser, Internet Explorer, and was quick to follow Netscape’s
lead by releasing its own VBScript language, along with a version of JavaScript called JScript, with the
delivery of Internet Explorer 3. As a response to this, Netscape and Sun, together with the European
Computer Manufacturers Association (ECMA), set about standardizing the language. The result was
ECMAScript, yet another name for the same language. Though the name never really stuck, we should
really be referring to JavaScript as ECMAScript.
JavaScript, ECMAScript, JScript—whatever you want to call it—was gaining ground by 1996. Version
3 browsers from Netscape and Microsoft both supported the JavaScript 1.1 language to varying degrees.
1
CHAPTER 1 ■ A BRIEF HISTORY OF JAVASCRIPT
■ Note JavaScript has nothing to do with Java, a programming language developed by Sun Microsystems.
JavaScript was originally going to be called LiveScript. JavaScript was probably chosen to make the new language
sound like it was in good company. Unfortunately, the choice of this name had the effect of confusing the two
languages in people’s minds—a confusion that was amplified by the fact that web browsers also supported a form
of client-side Java. However, while Java’s strength lies in the fact that it can theoretically be deployed in almost
any environment, JavaScript was always intended for the confines of the web browser.
JavaScript is a scripting language. Unlike a program that does everything itself, the JavaScript
language simply tells the web browser what to do. The web browser interprets the script and does all the
work, which is why JavaScript is often compared unfavorably with compiled programming languages
like Java and C++. But JavaScript’s relative simplicity is also its strength. Because it has a low barrier to
entry, nonprogrammers who wanted to cut and paste scripts into their existing web pages quickly
adopted the language.
JavaScript also offers developers the chance to manipulate aspects of the web browser. For example,
the language could be used to adjust the properties of a browser window, such as its height, width, and
position. Addressing the browser’s own properties in this way can be thought of as a Browser Object
Model. Early versions of JavaScript also provided a primitive sort of DOM.
The Document Object Model
What is the DOM? In short, the DOM is a way of conceptualizing the contents of a document.
In the real world, we all share something that could be called a World Object Model. We can refer to
objects in our environment using terms like car, house, and tree, and be fairly certain that our terms will
be understood. That’s because we have mutually agreed on which objects the words refer to specifically.
If you say “The car is in the garage,” it’s safe to assume that the person you’re talking to won’t take that
to mean “The bird is in the cupboard.”
Our World Object Model isn’t restricted to tangible objects though; it also applies to concepts. For
instance, you might refer to “the third house on the left” when giving directions. For that description to
make sense, the concepts of “third” and “left” must be understood. If you give that description to
someone who can’t count, or who can’t tell left from right, then the description is essentially
meaningless, whether or not the words have been understood. In reality, because people agree on a
conceptual World Object Model, very brief descriptions can be full of meaning. You can be fairly sure
that others share your concepts of left and third.
It’s the same situation with web pages. Early versions of JavaScript offered developers the ability to
query and manipulate some of the actual contents of web documents—mostly images and forms.
Because the terms images and forms had been predefined, JavaScript could be used to address the third
image in the document or the form named details, as follows:
document.images[2]
document.forms['details']
This first, tentative sort of DOM is often referred to as DOM Level 0. In those early, carefree days, the
most common usage of DOM Level 0 was for image rollovers and some client-side form validation. But
when the fourth generation of browsers from Netscape and Microsoft appeared, the DOM really hit the
fan.
2
Other documents randomly have
different content
her while there was life, there was hope. To suggest going to the
Duanes’! The image of Millicent rose before Miss Frink as the
antithesis of all that Adèle represented.
The latter smiled now, wan, but still unembarrassed.
“If you are thinking that it will be awkward for me to meet Hugh,
you are mistaken. He hasn’t lived all his life in a small town. He
knows his way about. No man ever thought less of a woman for
caring a lot for him, and Hugh and I will always be pals. I don’t think
any the less of him for coming into your house under false colors. He
carried his point.”
Miss Frink’s cheeks flushed. “Why, indeed, should you criticize
him? You did the same.”
“Only I didn’t carry my point. You never liked me.”
“Nor were you really my niece,” said Miss Frink briefly. “Adèle,” she
added—and there was appeal in her voice—“in this nine days’
wonder that is coming upon Farrandale I wish that, for the sake of
such hospitality as I have shown you, you would help to give the
true explanation of Hugh’s manner of introducing himself here. It
was Mr. Ogden’s idea entirely, inasmuch as I had not been friendly to
Hugh’s family. The sequel you know.”
Adèle’s stolid expression did not change, and she did not speak.
Miss Frink sat, looking at her and waiting.
“The truth generally comes out about everything,” said the young
woman at last.
“Adèle, Adèle,” said Miss Frink solemnly. “Why won’t you try to
make your life measure up to the beauty of your art? What I heard
last evening will be buried forever, as you know, unless you yourself
force a remembrance of it.” She looked at her watch. “Leonard will
take you over to Mrs. Cooper’s as soon as you are ready.”
Miss Frink went out and closed the door. For the first time in her
life she quivered with feeling. Her cheeks were flushed.
At the foot of the stairway she met John Ogden.
“Just the lady I want to see!” he cried cheerfully.
“Very well—my benefactor,” she said slowly.
“Do my ears deceive me? How good that sounds!” He seized both
her hands for a quick moment. Her flushed face and subdued tone
impressed him.
“I’m afraid you’re very tired, Miss Frink. Too much excitement,
perhaps.”
“Yes; in this world we must accept the bitter with the sweet, but—
nothing is any matter. What did you want of me?”
“Why, I’m leaving for New York to-night, and I wish to ask a
privilege before I go. I’ve no doubt there are numbers of gentle-folk
in Farrandale, but I happen to have made the acquaintance of only
two: Colonel Duane and his granddaughter. Tongues are going to
buzz for a while now, and I would like to beat the gossips to it with
those fine people. I should like to tell them my own part in what has
taken place.”
“Very well; I have no objection. Open confession is good for the
soul.” Miss Frink smiled wearily.
“Now you go to bed, Miss Frink. Please do. Let Grimshaw run the
city of Farrandale to-day.”
“He is very soon going to escort Mrs. Lumbard to her new abiding-
place at Mrs. Cooper’s.”
“That will rest you, eh?” asked Ogden appreciatively. “She really
intends to stay here and teach the young idea?”
“I don’t know. Perhaps I ought not to let her,” returned Miss Frink,
and her companion saw her hold her lip under her teeth to still its
quivering. “I seem to be sponsoring her, you see.”
“My dear Miss Frink, don’t you worry,” returned Ogden, speaking
low but emphatically, for they were still standing at the foot of the
stairs. “Don’t worry a minute. She won’t stick to that teaching a
month.”
Miss Frink gave him a rather tremulous smile of gratitude; and,
before Ogden took his hat to run out on his errand, he went up to
Hugh’s room where the latter was busy with his books.
“Say, boy,” he said, “I’ve just come from Miss Frink, and she had
just come from a talk with your friend Ally; and I tell you she was all
in.”
Hugh wheeled around in his chair and fixed a troubled look on his
friend.
“Yes, Miss Frink looked old and tired. Her pep was gone. Mrs. Re—
Lumbard is leaving to-day, it seems.”
“Leaving Farrandale?” asked Hugh, with an eagerness which his
friend misunderstood.
“No; don’t be afraid. I think Miss Frink is worrying about her being
turned loose among the Farrandale lambs; and I just want to say,
Hugh, that if you continue to pal with Mrs. Lumbard you’ll make a
great mistake from every point of view. You owe it to Miss Frink to
ease off and not encourage her. Miss Frink doesn’t want her coming
here.”
Hugh continued his troubled stare. “I hope you didn’t tell her the
damaging thing you told me—about the courts.”
“Of course not,” said Ogden impatiently; “but Miss Frink has the
woman’s number all right. I don’t know what their good-bye talk was
like, but this fine aunt of yours came out of it wounded. I tell you
she was wounded; and you want to think of her and protect her,
boy.”
“I’m going to, Ogden. Thank you,” replied Hugh, with a
submissiveness that surprised his friend.
John Ogden stared at him for a silent moment. “Well, then,” he
said, vaguely, and left the room.
CHAPTER XXI
PAVING THE WAY
Ogden went on thinking about the unusual docility with which
Hugh had received his exhortation. Also there was the devotion to
his studies at a moment when Ally was about to depart from the
house. How about that?
As he swung along he began to smile, his retrospective reflection
visualizing that slipping away into the moonlight which he had
witnessed and worried over last evening. After a minute in a rush of
thought his smile broadened. It seemed probable that the siren, in
the excited reaction from her performance, might have thrown a
scare into the heir apparent. At what juncture had she slipped away
from Hugh’s arm and Miss Frink slipped into it? Something had gone
on, to flush Miss Frink’s cheeks and weary her eyes this morning. All
the time that he himself was reading and fretting in his room last
evening, things had been happening downstairs. Anyway, the net
result had been a joyous one, as transpired unmistakably, later.
As Ogden tramped along, he was roused from his reverie to
realize that many persons he met greeted him. Realizing that they
remembered him as the busy master of ceremonies on the night
before, he responded cordially, and at last a short man in a checked
suit forced him to a standstill by his effusive manner.
“Goldstein, Mr. Ogden. I. K. Goldstein. We had but a minute’s talk
last night—”
“Ah, good-morning, Mr. Goldstein.” Ogden endeavored to edge
away from the plump hand with the diamond ring, after yielding to
its determined grasp.
“I cannot let you go without speaking again of that won-derful
evening. Such an artist you have there, that Mrs. Lumbard; she is
amazing. In a town the size of Farrandale we are all one family. You
put us all under obligation bringing such an artist here!”
“Oh, not I at all; Miss Frink—”
“Miss Frink! Oh, she is the genius of our city!” Mr. Goldstein made
known by gestures and upturned eyes that Miss Frink’s glories were
indescribable. “You come any time to see me, Mr. Ogden, and I wish
you would bring Miss Frink, and I show you both all over the Koh-i-
noor, our theater—”
“Thank you, Mr. Goldstein, but I am leaving town to-night—”
“But can’t you spare a little time, a half an hour this afternoon?—it
is a palace equal to any in the country. An organ—oh, such an organ
I have installed!—we open in less than a month; you would be
happy to see those velvet furniture in the lobby.”
“No doubt I should; but I have—”
“That young man at your house, the one who saved our wonderful
Miss Frink’s life, he should be in the pictures, you must see that.
There’s the story right there, too. I give him introductions; you send
him to me.”
John Ogden disengaged the clinging hand from his lapel as best
he could, and, mindfully thanking the manager of the Koh-i-noor,
contrived to escape with an apology for his pressing business.
Mr. Goldstein called after him cordially as long as he could hear.
Millicent Duane, enveloped in an apron, had brought out some
vegetables to prepare for the noon dinner and was sitting on the
porch with a large tin pan in her lap.
Her grandfather, who had been as usual working about the
garden, finally came slowly up the steps and sank restfully into his
favorite chair with the calico cushion.
“I can’t get that last piece she played out of my head,” he said.
“Mrs. Lumbard said it was a Marche Militaire. I should say so.” The
speaker drummed the rhythm on the arms of his chair.
“It was splendid,” agreed Millicent. She had been hearing all the
morning about the recital, and the English “fed up” but faintly
described her satiation.
The morning was so beautiful, the birds so tuneful, everything
that had not unfolded was so busy unfolding, and the air so full of
sweetness, Millicent could not understand why she felt at odds with
a world that was so amiably putting its best foot forward. She forced
herself to respond with ardor to her grandfather’s comments. She
was glad he had had such an unusual treat. He had seen nothing
but charm in Mrs. Lumbard’s manner; while Millicent still felt the
perfunctoriness of the star’s response to her own effort to express
her appreciation. Hugh had been beside her at the time, and as
usual Mrs. Lumbard had implied, or at least Millicent felt the
implication, that she was negligible, and the sooner she effaced
herself the sooner could life really go on. And it had gone on. The
stinging remembrance was that, before the Duanes left, Millicent had
seen Hugh and the star disappear together. The girl’s annoyance,
and resentment that she could feel it, made her an extra lively and
agreeable companion to her grandfather on the way home. He
remarked affectionately on the good the evening had done her, and
how she needed such outings; and she laughed and hugged him,
then went to bed, strains of music flowing through her hot head,
while her wet eyes buried in the pillow still saw the moonlight sifting
through the great trees with their black shadows, shadows through
which they were walking. She wanted—she knew now how
desperately she wanted—to walk in the moonlight with Hugh herself,
and her feeling that it was a contemptible wish did not help the
situation in the least.
Now, this morning, she sat there, enveloped in her pink checked
apron, the bright tin pan in her lap and her hands busy, while her
grandfather watched her fleeting smiles.
“Seems to me you look sort of pale this morning, honey,” he said.
“Dissipation,” she returned. “You know I’m a country girl.”
“It wasn’t late,” he returned reminiscently, still evidently enjoying
his memories. “How she did play the ‘Spring Song’! Simplest things
are the best, aren’t they, Milly? I think you look sweeter in that pink
apron than in your party dress,” he added.
“Didn’t I look nice last night?” asked the girl with unexpected
gravity.
“I should say so. Quite the up-to-date girl, standing there with
Miss Frink in her august dignity.”
“Grandpa, here comes Mr. Ogden.”
Colonel Duane rose as the caller opened the gate, and came to
the head of the steps to meet him.
“Don’t you move now, Miss Millicent,” said Ogden as the girl
started to put aside the big pan. “You make the most charming
domestic picture.”
“I can’t shake hands,” she returned, as he approached, and her
cheeks matched the gay hue of her apron while her eyes welcomed
him.
“This is my P.P.C.” he remarked, taking the chair Colonel Duane
offered.
“Oh, are you leaving us?” asked the old gentleman, returning to
his calico cushion. “I don’t know what they’ll do without you at Miss
Frink’s. That was a great treat she gave us last night. We haven’t
talked about anything else this morning; and your announcements,
and the general pleasant informality with which you managed the
occasion, gave it the last touch of charm. How is that delightful,
bright particular star, this morning?”
“Mrs. Lumbard? I haven’t seen her. She didn’t come down to
breakfast.”
“Well, she certainly earned that luxury,” responded the Colonel,
while Millicent’s gaze fell demurely to her busy hands. “I’d like to
have Milly take some lessons of her,” he added.
The girl flashed a quick glance up at the caller. “But I’m not going
to,” she said. “You can’t teach an old dog new tricks.”
The men laughed.
“What makes you go away, Mr. Ogden?” she added.
“Oh, life can’t be all Farrandale, you know. There’s business
waiting for me over there in the suburb of New York. I only came to
see Hugh because he was ill.”
“Hugh seemed quite proud of his brilliant friend last night,”
remarked the Colonel.
“Oh!” thought Millicent, “will he ever get through talking about
her!”
“I shouldn’t blame him if he lost his heart—so handsome and so
talented she is.”
Down went the young girl’s gaze again to the contents of her pan.
John Ogden saw the compression of her soft lips.
“Mrs. Lumbard is leaving Miss Frink to-day also,” he said.
Millicent looked up quickly again.
“Why is that? Not leaving Farrandale, I hope,” said the Colonel.
“No. I heard some one say something about the Coopers’. Of
course, Mrs. Lumbard has only been visiting Miss Frink.”
“The Coopers’!” echoed Millicent. “Is Mrs. Lumbard going to live at
the Coopers’?”
Ogden shrugged his shoulders. “Don’t quote me. I may be all off,
but I understood that.”
“Of course, they are Mr. Grimshaw’s cousins,” said the girl
reflectively.
“Another one of her satellites,” remarked the old gentleman,
smiling. “It was easy to see last evening that Grimshaw’s steady
head was all off its balance. I don’t believe you attractive bachelors
are going to let that charmer teach very long. One of you will snatch
her up.”
“I had to leave her to my rivals last night,” said Ogden. “I probably
lost out for good.”
Millicent’s grave large gaze was upon him, trying to discover
whether he was serious. She liked Mr. Ogden, but she would have
been perfectly willing he should snatch up Mrs. Lumbard.
“You’re quite a matchmaker, Colonel,” he went on. “I don’t know
how that rosebud over there behind the tin pan escapes your
machinations.”
Millicent threw a glance over her shoulder in evident search for
the rosebud, and Ogden laughed.
“Oh, she,” returned the old man regarding the girl with eyes of
placid love; “she has a heart like a flint. We have a lot of the nicest
boys you’d ever care to know, in Farrandale. She used to like them,
Milly did. When she was in the store, I used to have to complain of
the way she let them bother around and keep her up late; but now
she has left the store, and could sleep in the morning if she wanted
to, she won’t have a thing to do with them. They can’t do anything
right. One laughs too loud, one brings his mandolin and she hates it,
one parts his hair in the middle, and they all varnish their locks—”
“Grandpa!” Millicent interrupted him with rather unnecessary
severity, Ogden thought. “I don’t like to be discussed.”
Her grandfather laughed toward her affectionately, and raised his
eyebrows. “Gracious!” he exclaimed. “What a grown-up baby I
have.”
“Well, I must get at my business,” said the visitor. “I came this
morning, not only to say good-bye, but to let you nice people be the
first to know something concerning our friend Hugh.”
Millicent’s collection of knives hit the tin pan and clattered to the
floor. The pan so nearly fell after it that Ogden, springing forward,
caught it just in time. The girl’s hands trembled as she grasped it,
and murmured some inarticulate thanks.
“Ah, many a true word spoken in jest,” said the Colonel. “That is
why the lovely pianist is leaving Miss Frink’s; but conventionality can
be carried too far, I think.”
John Ogden was busy restoring Millicent’s goods, wares, and
chattels to her lap, and he camouflaged her tremor by laughing
allusion to Uncle Remus, and Brer Rabbit’s clatter with his seben tin
plates, and seben tin cups.
“No, nothing of that kind, Colonel Duane,” he said as he took his
chair again. “This is a story that I will make brief. Long ago there
was a feud in Miss Frink’s small family.”
Millicent tried to moisten her dry lips, and ceased attempting to
use the knife which seemed determined to beat a rat-a-plan against
the side of the pan.
“She had a nephew, Philip Sinclair, whom she loved; but his
opposition to her plans for him angered her to such a degree that it
made a complete break. She never met his wife or children, and
refused to know them. I was a friend of that family, and Hugh was
one of the children. When he returned from the war, I hunted him
up.”
Ogden glanced at Millicent. She was leaning back in her chair, her
lips parted, her face very pale, and her eyes full upon him. He
looked back at once to Colonel Duane, who was giving him similar
fixed attention.
“When I met Hugh, whom I had last seen as a child, you can
understand what an impression he made on me, and how I thought
of his lonely great-aunt whom I had come to know well in the way of
business. Hugh was alone, and drifting, like so many of the returned
boys, and a scheme came into my head which I suggested to him. It
was to come here with a letter of introduction from me, and, using
only his first two names, Hugh Stanwood, apply to Miss Frink for a
job in Ross Graham Company. I knew there was no hope of her
receiving him if she knew he was the son of the man who had so
bitterly disappointed and offended her, and I trusted to his winning
her esteem before the truth came out. I had a lot of difficulty in
getting Hugh’s consent to this, but at last I succeeded. I fitted him
out for the experiment, which, of course, put him under some
obligation to me: an obligation which was my weapon to hold him to
our compact. He has had times of hating me, because Hugh is
essentially honest; and the remarkable coincidence which threw him
into his aunt’s house as a guest, instead of allowing him to be an
employe in her store, gave him many a weary hour of thought which
he used mostly for condemnation of me and himself. I came on as
soon as I learned of his illness, and found that Miss Frink had
become very fond of the boy. When she at last experienced the
shock of discovering who he was, she suspected me at once as
being the instigator of the plan, and for a time she was torn:
undecided as to whether I should be cannonaded or canonized. I
judge she has decided on the latter course, for this morning she
called me her benefactor.”
Ogden paused.
“Extraordinary!” said Colonel Duane. “I’ll warrant the old lady is
happy.”
Millicent said nothing; just gazed.
“My reason for coming to tell you this”—Ogden addressed Millicent
now—“is that, as the affair is known and discussed, Hugh is going to
be misunderstood and condemned. Thoroughly disagreeable things
are going to be said about him. He is going to be called a fortune-
hunter.”
“He was, wasn’t he?” broke in Millicent suddenly.
“I was. It was I. Please remember that. I exacted from him at the
time a promise that he would not reveal their relationship to Miss
Frink until I gave him permission; so, chafe as he might and did, he
kept that promise. He’s a fine youngster; and to my relief and
pleasure his aunt realizes it, and they understand each other.”
Colonel Duane nodded and smiled. “A story that ends well. Eh,
Milly?”
She assented with another of the fleeting smiles. This change in
Hugh’s fortunes put him still farther away. No one could tell to what
lengths Miss Frink’s pride and joy would go, and what advantages
now awaited him.
“What did you say Hugh’s name is?” asked the Colonel.
“Sinclair. Hugh Stanwood Sinclair, and one of the finest,” returned
Ogden. “I hope I have set him right in your eyes and that you will
defend him as occasion arises.”
“We’re fond of Hugh,” returned the old gentleman quietly, “and I
don’t think you need dread unkind comments on him. You know the
way of the world, and Miss Frink’s handsome heir is going to be
persona grata to everybody, except, perhaps”—Colonel Duane
laughed—“Leonard Grimshaw.”
Ogden smiled. “The nephew was introduced to him this morning
at breakfast; and, except for a look which endangered the sweetness
of the cream, he took it very calmly.”
After the caller had departed, Colonel Duane came back to his
chair.
“Well, well,” he said. “So the hero wasn’t called Prince Charming
for nothing, was he? A story that ends well. Eh, Milly? He’ll grace the
position, eh? I like the idea. Indeed, I do. Isn’t it fine?”
And Millicent said it was, and gathered up her paraphernalia and
went into the house.
CHAPTER XXII
ADJUSTMENTS
As soon as she had parted from John Ogden, Miss Frink went to
her study. Her secretary was in his place. Could this possibly be the
world of the barren yesterdays? The same world in which she and
Leonard Grimshaw had sat at their adjoining desks in this room and
opened mail, dictated letters, and considered investments, for so
many years? Her welling sense of gratitude gave her a novel attitude
of sympathetic comprehension. If her secretary, so long the sole
partner and confidant of her days, were suffering now from being to
a degree usurped, it would not be surprising. She felt a sort of
yearning toward him.
He rose at her entrance, grave and businesslike as usual. She took
her customary place beside him, and he seated himself, drawing
toward him the morning’s mail.
“Never mind that now, Grim. We will attend to it this afternoon, if
I can keep awake.” She gave a little laugh.
He glanced around at her. Miss Frink, flushed and laughing,
unmindful of the mail! From bad to worse!
“The gayety of last evening too much for you?” he responded,
with a gravity so portentous as to be a rebuke.
“I suppose so. Say, Grim, how did Goldstein get in here?”
“I asked him. I knew your desire not to have anybody overlooked.”
“But we have never had any contact with him.”
Grimshaw cleared his throat, and drew forward a bunch of pencils
and put them back again.
“He is one of our stirring citizens,” he said.
“I know he stirs me,” remarked Miss Frink.
“He enjoyed the evening greatly,” declared Grimshaw.
“All right; but, if he ever comes to make his party call, remember
he is your guest.”
“Very well, Miss Frink.”
“Now, my dear boy,” she went on, and she laid a hand on her
secretary’s arm. He regarded it under dropped lids. “I feel I want to
say a few things to you in this great change that has come into my
life.”
“I have anticipated it,” he returned. “You wish to dispense with my
services?”
Miss Frink withdrew her hand. “What could put such a wild idea
into your head, Grim? So far from dispensing with you, I feel it an
occasion to speak of my appreciation of your faithful service. In the
great joy that has come to me I long to give happiness. If it pleases
you to know that your efficient work is not taken for granted, but
that it is given its full value, I want you to realize that I thank you.”
She paused and the secretary bowed silently.
“In the changes that will result from the discovery of my nephew,
I want you to know also that none will affect you. You are
mentioned in my will, and nothing regarding you in that will be
changed.”
Grimshaw did not alter his position, but some pulse leaped to his
throat. It was not a leap of gladness. If that were the case, then his
employer’s plans for him had fallen below expectations.
“In short,” said Miss Frink, “since this great blessing that has come
to me should make me a better woman, I hope to be a better friend
to you and to all.” As her companion did not break the pause that
followed this, she added: “I hope you don’t begrudge it to me,
Grim?”
“By no means, Miss Frink,” he responded, without looking up.
“Pardon me for a moment, I am much moved.”
Miss Frink was touched. “The good boy!” she thought. “Probably
constant contact with me has made it impossible for him to express
any feeling that does not regard dollars and cents.”
“My narrow life could not fail to narrow you,” she said humbly. “I
hope we may both expand after this.”
Neither spoke for a minute. Grimshaw continued to look down,
one hand toying with a paper-cutter.
At last she spoke: “I told Adèle you would take her over to Mrs.
Cooper’s as soon as she was ready.”
“I shall be glad to,” he returned. “Adèle made a great impression
last night.”
“Indeed, she did. There is no doubt that she can teach here if she
wishes to. I have just been saying to her that I hope, when the
subject comes up, she will aid in letting it be known what a passive
part Hugh played in the camouflaged way he came to Farrandale.
Mr. Ogden was the motive power of it all, and you must help, too,
Grim, in giving the right impression.”
The secretary turned to her with a strange smile. “Do you think
that your nephew and heir will need any apologies?” he asked
slowly. Miss Frink felt uncomfortably the inimical attitude back of the
words. “If he does, he will never know it, and you will never know it.
That is the advantage of being the Queen of Farrandale.”
“The boy is jealous!” she thought.
“I hope,” he continued, “that your absorption is not so great that
you cannot use your influence to help Adèle, even though she is
leaving your house.”
Miss Frink felt the criticism in this. She was silent for a space.
“Adèle came here camouflaged also, Grim,” she said quietly. “She
will tell you about it.”
The secretary flashed a quick look around at her. “Perfectly
innocent in one case, I suppose,” he said, “and unpardonable in the
other.”
Miss Frink was too deeply troubled about Adèle’s future in
Farrandale to be ruffled by this. “It was her own idea,” she said.
“That makes some difference. I am glad she has a friend in a truly
upright man like you, Grim. Help her to be a good woman.”
The secretary frowned in surprise at the earnestness of this
appeal; but, before he could speak, Adèle entered the room dressed
for driving, smiling, and with head held high.
Her departure with Grimshaw a few minutes later was decorous.
Miss Frink was at the door.
“Hugh will want to say good-bye to you,” she said. “Won’t you call
him, Grim?”
“Oh, no,” interrupted Adèle. “He is at his studies. Don’t disturb
him. We shall always be meeting.”
Miss Frink stood on the veranda and watched the motor drive
away. She drew a long breath of the sweet air. Whatever should
come now, Adèle was gone from the house. The relief of it!
In the motor, the two, sitting side by side, exchanged a mutual
regard.
“It was very, very sweet of you to write me that note,” said
Grimshaw.
“I thought it would help.”
“There has been some trouble between you and Miss Frink,” he
pursued.
Adèle lifted her eyebrows and gave a little laugh. “Yes. Mr. Ogden
kindly tipped her off that I was merely the step-grandchild of her
beloved chum.”
“Step-grandchild?” repeated Grimshaw.
“Yes. Complicated, isn’t it?—and not worth while trying to
understand. It served her as well as anything else as an excuse to
get rid of me.”
Grimshaw frowned. He was angry with his employer for sending
this lovely creature away from the luxurious home, the Steinway
grand, and himself; but Miss Frink’s novel gentleness in their
interview chained his always cautious tongue; then, if Adèle had
really deliberately misrepresented facts, he knew how that must
have offended Miss Frink’s rigorous principles.
“You will find the change to the simplicity of the Cooper home
rather hard, Adèle.”
“No harder than your discovery that henceforward you are
second-best in your home,” she returned; but her voice was
sympathetic, even tender. “Perhaps you will have to go away.”
“No; she doesn’t want me to leave,” he answered dispiritedly. He
turned again suddenly to his companion: “You must tell me, Adèle,
how I can help you. How about this teaching business?”
She smiled at him, her sweetest. “Leonard, can you see me
trudging around in all weathers and teaching youngsters how to play
scales?”
He shook his head.
“Hu—somebody said it was like harnessing a blooded horse to a
coal wagon to make me teach.”
Color rushed to Grimshaw’s face. “Adèle, it can’t be! You know I—”
She interrupted him with a laugh. “Look out! You nearly ran into
that Mr. and Mrs. Rube in their light wagon. Now, I’ll talk to the
motor man if he doesn’t look at me.” Grimshaw kept eyes ahead,
and she continued. “I never had the dimmest idea of teaching. I
knew something would turn up, and it has. Did you notice Mr.
Goldstein draw me aside for a few minutes last night?”
“Yes; confound his impudence, keeping everybody else waiting.”
“Not at all. Mr. Goldstein is a highly important friend. He wants me
to take charge of the music at the Koh-i-noor. He’s mad about the
new organ, and he says I’m just the person they have been looking
for.”
“Can you play the organ?”
“Oh, yes, I’ve played one; and I have three weeks before they
open. He wants to add an orchestra later, and he wants me to take
full charge of the musical end of the theater.”
“Pretty fine—but Miss Frink—”
“Who is Miss Frink?” asked Adèle saucily. “Leonard”—she leaned
toward him, and her pressure thrilled him—“you and I have our own
lives to live.”
“That arrangement would make you very independent, Adèle.”
“I can never be independent of the people I’m fond of,” she
answered softly, and withdrew from him.
“Strange that Goldstein should be the one to approach you just
now. I have had some business dealings with him, and he is all
right; he has big, generous ideas. There is nothing small about
Goldstein. He is after me now to put through a deal for him, but I
don’t know. He makes it very tempting for me, but I’m afraid Miss
Frink—”
“Oh, don’t be tied to her apron-string. What is the deal?”
“Well, then, mum’s the word,” said Grimshaw, smiling.
“Oh, yes, mum as an oyster,” she returned.
“He wants to buy that place where the Duanes live.”
Adèle’s heart leaped. “What does he want of that little shanty?”
“He wants to tear it down and put up a flat building to cover the
whole lot.”
“Splendid idea,” responded Adèle. “It’s high time Farrandale had
something handsome in the way of an apartment building, and Mr.
Goldstein would do something with class.”
“But Colonel Duane’s garden. He is wrapped up in the place, and
they haven’t any money for another. It just happened that the
cottage fitted their needs and was cheap.”
Color brightened Adèle’s pale face. Lady Luck was coming her
way. To get rid of Millicent Duane was a rosier prospect than even
the music at the Koh-i-noor.
“They could find a place in the country,” she said. “It would be
something new if Miss Frink wanted to throw over such a chance to
turn a few honest thousands. You ought not to let her. You ought to
look after her better than that.”
“I told Goldstein that there was a probability that sentiment might
enter into this matter; and he has offered to make it very much
worth my while to put the sale through. It is the biggest temptation
I ever received.” The speaker’s eyes shone.
“I’ll give you another,” said Adèle, leaning toward him again. “If
you will put through the sale of the Duane place, I will—forget that
there is another man in the world but you.”
Grimshaw flushed, and the road being clear just then, he met her
soft gaze.
“Is that a promise, Adèle?” he asked.
“A solemn promise,” she answered.
John Ogden returned to his hostess in time for luncheon. Leonard
Grimshaw had remained for lunch at his cousin’s, for Adèle wanted
him to go with her afterward to see Mr. Goldstein and talk over her
contract. So it was that the three who felt very close to one another
to-day sat at the table alone. Stebbins was dismissed, to his regret,
for he had found breakfast very interesting and he wished to
continue gathering data.
Ogden noted that the flush on Miss Frink’s cheeks, and Hugh’s
subdued manner, persisted.
“I had a delightful call this morning,” he said in his usual cheerful
tone. “I dropped my little bomb on the Duanes’ piazza with great
effect.”
Hugh glanced up at him sharply.
“I do like those people. They have a distinctly pleasant
atmosphere. Colonel Duane, always looking like somebody in
particular, and so hospitable, and Miss Millicent more like a rosebud
than ever this morning in a pink apron, delving in a big tin pan.”
“He went to tell them what a happy woman I am,” explained Miss
Frink, looking across at Hugh. He met her eyes, and smiled
acknowledgment, the more gently for the mutiny within. At last he
was honest, but he was more than ever conspicuous and discussed.
He hated it. His ears burned now.
“I suppose they nearly fainted,” he remarked. “I’m sure you told
them that I was a puppet and you pulled the wires.”
“Don’t put it that way, Hugh,” pleaded Miss Frink.
“I can’t help it, Aunt Susanna! It’s a mess!”
“Don’t say so, dear boy.” Hugh met her bright, speaking eyes. “I
have always been a successful woman, that’s what the world calls it;
but I never was a happy one until last night.”
“I’m not much to make you happy,” said the boy restively. “Just a
pawn in a game, not a penny in the world of my own, in debt to
Ogden, and a sneak in the eyes of your town—”
“Oh, my boy! Oh, Hugh!” There was such pain and longing in Miss
Frink’s tone that it checked him. Beside all that he expressed was
the constant irritation and humiliation that remained from the scene
with Adèle.
“Hugh, you told me last night that you—” Miss Frink stopped
because something rose in her throat. No one broke the silence. “I
know how your young pride is hurt,” she went on at last, “but it will
be restored.”
“Colonel Duane said,” put in Ogden, “that there would be very
little talk: that wherever you went, Miss Frink’s nephew would be
always welcome.”
“That is true,” she agreed; “and, Hugh, if you can be so unselfish,
don’t spoil this great joy of mine—a child belonging to me; but take
it as if we had known all along that you were mine. In perfect
frankness let me do for you what it is my right to do. In the
presence of Mr. Ogden, who has accomplished such wonders for us,
let me say that he and I shall together settle such of our obligation
to him as can be paid, and then you, Hugh, until you are admitted to
the bar, will accept from me your education, and your allowance,
without a thought of dependence—”
Hugh regarded the earnest speaker with a mixture of resistance
and appreciation.
“Ross Graham Company—” he began—
“Can take care of itself,” said Miss Frink with a return of her brisk,
curt manner. “You can always get competent managers.” John
Ogden’s mind took a leap back to the day when he told Hugh that
the department store might belong to him. “Now I know,” went on
Miss Frink, “that you’re a bit afraid of your old aunt, a little afraid
that in my pride I may want to put you into a velvet suit and lace
collar à la Fauntleroy, or its equivalent; but you needn’t be afraid. I
haven’t lived seventy-two years for nothing, and I didn’t make a
mess of my treatment of your father for nothing. Neither am I in my
second childhood. I have all my faculties, and, with so much now to
live for, I expect to keep them until I’m one hundred. I don’t want to
make an idol of you. I want you to be a man among men, and stand
on your own feet; but it’s my right to give you a start, and I like to
believe that you have enough common sense to accept it in the spirit
in which it is offered, without any fuss or foolish hair-splitting.”
Hugh looked around at Ogden, who nodded at him.
“Put that in your pipe and smoke it,” remarked Ogden.
Hugh, pushing back his chair, rose and came around to Miss Frink.
“There’s only one answer a fellow can make to all that, Aunt
Susanna,” he said, and, stooping, he kissed her.
“Now, then,” she, too, rose, “please go on the veranda and watch
for Millicent. I want to see Mr. Ogden a few minutes in the study,
and I’ll let her know when I’m ready for her.”
Hugh wandered through the hall, pausing between the portières
of the drawing-room and looking at the piano. Was it only last
evening that Ally had done her brilliant work? He shook his head,
went out to the piazza, and started to take the swinging seat, but
changed his mind, and, throwing himself on a wicker divan, lighted a
cigarette. He was conscious of a deep soreness in the thought of
Adèle. What a series of foolish moves her life had been! He shrank in
distaste from it all.
What a different specimen of girlhood was Millicent Duane! Of
course, she was nothing but a child, with her ready tears and
blushes; still, it was better to be crude, and sweet, and pure, than
sophisticated and audacious. He wished he could have seen her face
when Ogden told them his news. A certain looking up to himself
which the girl had evinced in their daily meetings, he suddenly found
was valuable to him. Colonel Duane had said Miss Frink’s nephew
was always sure of a welcome. He knew what that meant, and the
implication again stirred his rebellion. He would know when he saw
Millicent to-day if he had much to live down in her transparent soul.
CHAPTER XXIII
MILLICENT
Very soon Millicent’s familiar figure appeared at the iron gate.
Before she started from home she had talked with her grandfather.
“You’re sending a message to Hugh by me that it will be more
convenient for you to see him in the morning after this,” she said.
“But it wouldn’t.” Colonel Duane looked surprised.
“Yes, it will be,” returned Millicent firmly.
The old gentleman blinked. “What’s this? Tired of the walks over
here together?”
“Never mind details, dear.”
“You’re a funny child, Milly. Hugh will feel something unfriendly in
the change, just at the present time.”
Millicent seized her grandfather’s arm. “Dearest, everything
wonderful is going to come to Hugh, now,” she said earnestly, “and I
would like to be out of it. I don’t want to hear him talk about it.
Hugh Sinclair isn’t Hugh Stanwood. He won’t be anything to us; not
even a friend except at long intervals and—can’t you understand? I’d
rather be the one to do the dropping.”
She released him suddenly and ran out of the house. Her
grandfather stood in the same spot for some minutes, considering.
“It’s the most natural thing in the world,” he said to himself at last.
“I don’t see how she could help it; but Milly has plenty of spirit, and
I’ll take the hint till he goes away. Of course, he’ll be going away to
law school.”
Now, as Millicent entered Miss Frink’s grounds and discerned Hugh
on the porch, she saw him rise and throw away his cigarette. He
came down the steps to meet her, looking unusually grave. His eyes
studied her as if he must know her attitude before she spoke. She
put her hand in the one he offered.
“How now that the cat is out of the bag?” he asked.
“What difference can it make to me?” she returned with a
coolness that did not satisfy him.
“I’m glad if it doesn’t make any. I thought perhaps there wouldn’t
be any route sufficiently roundabout for you to take me home this
afternoon.”
His gaze continued to study her as they ascended the steps.
“Oh, I was to tell you that Grandpa can’t have you to-day. He will
be glad to see you to-morrow morning if you can come—and always
in the morning hereafter.”
Hugh nodded. Millicent started to go into the house.
“Sit down a few minutes,” he said. “Aunt Susanna and Mr. Ogden
are busy in the study. He is leaving to-night. She said she would call
you as soon as she was ready.”
Millicent seated herself in the swinging couch and Hugh promptly
took the place beside her.
“So our walks are over, are they?” he asked, still grave.
“Yes. Life is just like chapters in a story, isn’t it?” she replied
hurriedly. “One closes and another begins. This swing makes me
think of Mrs. Lumbard. Grandpa is perfectly wild about her ever
since last night. Mr. Ogden said she was going to live at the
Coopers’, and on my way over here I met a friend who said he had
heard that the manager of the Koh-i-noor is going to try to get her
to provide their music.”
Hugh nodded. “That would solve a problem for her,” he said.
There was nothing natural about Millicent to-day, and he had seen
her shrink when he took the place beside her in the swing.
She went on: “Something big like that would seem more fitted to
Mrs. Lumbard than teaching. I wonder if she will take the position.
You’ll miss her here, won’t you?”
“Yes, another of those chapters that close while another begins. If
only the story grows more interesting as life goes on.”
“I’m sure it will for you.” That was too personal. She hurried
headlong. “And I think it does for all of us. You talked to that cute
girl Damaris Cooper last night. She will be delirious with Mrs.
Lumbard living there, and playing at the Koh-i-noor. Who said
Farrandale was dull!” Millicent laughed.
Hugh had not smiled since she came, and she was so
uncomfortable under his questioning eyes that she welcomed the
opening of the door and the appearance of John Ogden who took in
the deceptively intimate appearance of the swing.
“Your sleepy lady awaits you, Miss Duane,” he announced, “and
you certainly will do a missionary act to make her rest. She needs it.”
Millicent sprang up. “So I’ll say good-bye once more.” He held out
his hand, and the girl gave him hers.
“Farrandale will be very glad to see you back some day, Mr.
Ogden.” She vanished into the house.
“It’s just as I expected,” said Hugh gloomily. “Millicent is entirely
changed, and Colonel Duane can see me only in the mornings after
this. It’s significant of the whole spirit that I shall have to meet.”
John Ogden viewed the downcast gaze.
“You crazy—” he began—“I’ll say I hate to leave you. You’ll be
deserting Miss Frink between two days, as likely as not.”
“No, I won’t,” returned Hugh decidedly. “I’ve made up my mind to
stay with her.”
“Well, I’m glad to hear that.”
“But it makes me—if Millicent had cried or done anything natural, I
could stand it; or if she would say right out that she is disgusted, I
could stand it; but to have her feel that it is too bad to talk about;
that gets me because what she feels is what everybody worth caring
about will feel.”
John Ogden regarded the boy as he sat there in the swing,
dejected, and his own lips twitched.
Hugh looked up suddenly. “Don’t you think she’s a fine girl,
Ogden?”
“I do. Pure as a drop of dew; fine as a rose-leaf, softly iridescent
as a bird’s wing, transparent as crystal—”
Hugh frowned in displeased surprise.
“I wish you could do anything but chaff,” he said.
“I’m not chaffing,” replied Ogden; “but I must modify that a little,
I should have said, sometimes as transparent as crystal.”
“Are you in love with her?” blurted out Hugh.
“Perhaps I should be if I hadn’t known Carol. The man that she
loves will be in luck, for though tender as a flower she’s as stanch as
an oak tree.”
“You should write poetry,” said Hugh dryly. “After all that, you
can’t blame me for preferring that that sort of person should
approve of me.”
Ogden, sitting in a hammock and swinging his foot, regarded the
other quizzically for a silent moment.
“Your lions in the way are going to turn into kittens, boy,” he said
at last. “And if they didn’t, isn’t it worth something to have
transformed the life of another human as you have Miss Frink’s? Isn’t
it worth meeting with some annoyance?”
Hugh shrugged his shoulders in silence.
When Millicent entered her employer’s room, the lady was not
lying down as usual. She met the girl with a sort of smiling
exaltation.
“Do I look any different to-day?” she asked.
“You do look different. You have such pink cheeks. I suppose you
are still excited from last night.”
“Perhaps so.” As she spoke, Miss Frink drew the girl down beside
her on the divan and looked blissfully into her face. “What a
comment it is on me, Millicent, that you are the only woman friend I
have to pour out to at a time like this—and you not a woman yet,
just a little girl who can’t appreciate happiness, because you’ve
never had anything else.”
“Oh, I have, Miss Frink, I’ve been terribly unhappy—is it because
you’re happy that you look so rosy?” Millicent’s heart beat under the
full, bright gaze bent upon her.
“Yes, all at once. The last time you saw me I was nobody. I was
grubbing along the way I have all my life, nobody caring about me
except to get the better of me in a business deal, and now to-day—
do you wonder my cheeks are pink? I’m a grandmother, Millicent.”
“You are!” The girl’s lips were parted.
“You know it’s even nicer than being a mother. Everybody knows
that grandmothers have the best of it. Mr. Ogden has told you that
Hugh belongs to me, and at midnight last night we, Hugh and I,
were alone together, and—and we talked of it. He seemed to be
glad. He kissed me like a real grandchild. Millicent, it seemed too
wonderful for words that I should be really happy! Those young
arms around me made me feel richer than—doubling my money on
a corner lot.”
Millicent began to swallow fast.
“I’m so—so gl-glad,” she said. “I’ll try—not to cry.”
“You’re very sweet to care, child. You and Hugh are so well
acquainted I feel you will always take an interest.”
“It was wonderful!” said Millicent. The eagerness in the bright
eyes impelled her on. “Hugh is—my grandfather thinks he is an
unusual fellow. He has always seemed so frank, and kind, and
simple. He takes an interest in Grandpa’s garden and is so nice
about it. He often says he wishes he owned a little place just like
ours.”
“Oh, he does, does he?” returned Miss Frink dryly. “Well, you’re
ahead of me. I have never heard him express a wish for anything.”
“Now, Miss Frink, you must lie down,” said the girl. “Mr. Ogden
told me to be sure to make you rest.” She arranged the pillows just
as her employer liked them, persuaded her to change her dress for a
negligée, and soon the happy woman was settled on the couch.
“You’ll guarantee I won’t wake up and find it all a dream?”
“I promise it,” she said.
Hugh was still on the piazza and alone when she went out. He
rose at sight of her. She had never seen him look so serious. He did
not advance, just looked at her in silence. She went to him, her
hands outstretched.
“I’ve been talking with her,” she said. Her own repressed feelings,
the remembrance of Miss Frink’s exaltation, and the wonder of
Hugh, himself, overcame her. She could not speak; but her smile and
her suddenly flooded eyes made his gravity break into sunshine.
“It’s all right, then, is it, Millicent?” he asked eagerly.
She tried to pull a hand away to get her handkerchief, but he held
it fast and, seeing the corner of linen protruding from the low neck
of her dress, he took it out and dried her eyes himself.
“I’m not going to cry—much,” she said, smiling, “but she is so
happy.”
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