100% found this document useful (3 votes)
13 views

Prototype and script aculo us you never knew JavaScript could do this 1st Edition Christophe Porteneuve download

The document is a promotional overview for the book 'Prototype and script.aculo.us You Never Knew JavaScript Could Do This' by Christophe Porteneuve, which focuses on enhancing JavaScript applications using the Prototype and Scriptaculous libraries. It includes reader testimonials highlighting the book's effectiveness in teaching JavaScript frameworks and best practices. Additionally, it provides links to download the book and other related resources.

Uploaded by

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

Prototype and script aculo us you never knew JavaScript could do this 1st Edition Christophe Porteneuve download

The document is a promotional overview for the book 'Prototype and script.aculo.us You Never Knew JavaScript Could Do This' by Christophe Porteneuve, which focuses on enhancing JavaScript applications using the Prototype and Scriptaculous libraries. It includes reader testimonials highlighting the book's effectiveness in teaching JavaScript frameworks and best practices. Additionally, it provides links to download the book and other related resources.

Uploaded by

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

Prototype and script aculo us you never knew

JavaScript could do this 1st Edition Christophe


Porteneuve pdf download

https://ebookfinal.com/download/prototype-and-script-aculo-us-
you-never-knew-javascript-could-do-this-1st-edition-christophe-
porteneuve/

Explore and download more ebooks or textbooks


at ebookfinal.com
Here are some recommended products for you. Click the link to
download, or explore more at ebookfinal

CNET Do It Yourself Home Networking Projects 24 Cool


Things You Didn t Know You Could Do 1st Edition Jim
Aspinwall
https://ebookfinal.com/download/cnet-do-it-yourself-home-networking-
projects-24-cool-things-you-didn-t-know-you-could-do-1st-edition-jim-
aspinwall/

I Never Knew That About London 7th Edition Christopher


Winn

https://ebookfinal.com/download/i-never-knew-that-about-london-7th-
edition-christopher-winn/

You Were Never Born John Wheeler

https://ebookfinal.com/download/you-were-never-born-john-wheeler/

How You Do What You Do Create Service Excellence That Wins


Clients For Life 1st Edition Bob Livingston

https://ebookfinal.com/download/how-you-do-what-you-do-create-service-
excellence-that-wins-clients-for-life-1st-edition-bob-livingston/
Do You Understand Me 1st Edition Sofie Koborg Brsen

https://ebookfinal.com/download/do-you-understand-me-1st-edition-
sofie-koborg-brsen/

This Year You Write Your Novel 1St Edition Edition Walter
Mosley

https://ebookfinal.com/download/this-year-you-write-your-novel-1st-
edition-edition-walter-mosley/

The Book of Hebrew Script History Palaeography Script


Styles Calligraphy Design Ada Yardeni

https://ebookfinal.com/download/the-book-of-hebrew-script-history-
palaeography-script-styles-calligraphy-design-ada-yardeni/

Prototype and Scriptaculous in Action 1st Edition Dave


Crane

https://ebookfinal.com/download/prototype-and-scriptaculous-in-
action-1st-edition-dave-crane/

What Can You Do with a Major in Biology Real people Real


jobs Real rewards What Can You Do with a Major in 1st
Edition Bart Astor
https://ebookfinal.com/download/what-can-you-do-with-a-major-in-
biology-real-people-real-jobs-real-rewards-what-can-you-do-with-a-
major-in-1st-edition-bart-astor/
Prototype and script aculo us you never knew JavaScript
could do this 1st Edition Christophe Porteneuve Digital
Instant Download
Author(s): Christophe Porteneuve
ISBN(s): 9781934356012, 1934356018
Edition: 1
File Details: PDF, 4.46 MB
Year: 2007
Language: english
What readers are saying about Prototype and script.aculo.us

I use Prototype and script.aculo.us all day in my work, yet I learned a


lot reading this book. I frequently dive back into it to find information
I can’t find anywhere else. This is a helpful book written by an expe-
rienced teacher that will help anybody who wants to easily add some
JavaScript features to their application.
Stéphane Akkaoui
Ruby on Rails developer, Feedback 2.0

If you are thinking about learning a JavaScript framework (or would


like your team to...), this book is a step-by-step guide to painless Pro-
totype and script.aculo.us. From the basics to advanced code, this
book is written in the cleanest style. You’ll be amazed to find out all
that JavaScript can do.
Arnaud Berthomier
Web developer, Weborama

This is a book that every Prototype and script.aculo.us developer


should have. It’s more than a reference book; you will find everything
you need to know about these two frameworks, and you’ll learn good
JavaScript practices. I have learned great tips about script.aculo.us
and have discovered Prototype functions to make my code more con-
cise and more readable while improving performance. Thanks for this
book!
Sébastien Gruhier
Founder and CTO, Xilinus

Tired of waiting around for a page to reload, again and again? Well,
if you’re like me, you’re looking for a smart and elegant way to inject
pieces of Ajax into your application. Well, you’ll find in this book all
you need to know about Prototype and script.aculo.us. This book will
show you the best practices without forgetting the fun!
Amir Jaballah
Technical Leader, Fastconnect
At Relevance, we use Prototype and Scriptaculous for all of our web
projects. When we train other developers, we always get the same two
questions: (1) Where can I get more information on the libraries? and
(2) Where can I learn to program JavaScript in a modern, functional
style?
Prototype and Scriptaculous answers both of these questions.
Christophe demonstrates the power and the beauty of these libraries,
and of the idiomatic JavaScript style they employ. And he doesn’t
just skim the surface—his intro chapter shows more advanced Java-
Script usage than some entire books on the subject. Even after years
of using Prototype and Scripty, I learned new things in every chapter.
Thanks Christophe!
Stuart Halloway
CEO, Relevance, Inc.
www.thinkrelevance.com
Prototype and script.aculo.us
You Never Knew JavaScript Could Do This!

Christophe Porteneuve

The Pragmatic Bookshelf


Raleigh, North Carolina Dallas, Texas
Many of the designations used by manufacturers and sellers to distinguish their prod-
ucts are claimed as trademarks. Where those designations appear in this book, and The
Pragmatic Programmers, LLC was aware of a trademark claim, the designations have
been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The
Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g
device are trademarks of The Pragmatic Programmers, LLC.

Every precaution was taken in the preparation of this book. However, the publisher
assumes no responsibility for errors or omissions, or for damages that may result from
the use of information (including program listings) contained herein.

Our Pragmatic courses, workshops, and other products can help you and your team
create better software and have more fun. For more information, as well as the latest
Pragmatic titles, please visit us at

http://www.pragprog.com

Copyright © 2007 The Pragmatic Programmers LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmit-


ted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher.

Printed in the United States of America.

ISBN-10: 1-934356-01-8
ISBN-13: 978-1-934356-01-2
To Élodie, my love, ever supportive.
You’re my true home.
Contents
Preface 13

1 Introduction 15
1.1 It’s About Time . . . . . . . . . . . . . . . . . . . . . . . . 15
1.2 What’s in This Book, and How Is It Organized? . . . . . 17
1.3 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 18

I Prototype 20

2 Discovering Prototype 21
2.1 What Is Prototype, and What Is It Not? . . . . . . . . . . 21
2.2 Using Prototype in Our Project . . . . . . . . . . . . . . . 22
2.3 What Does Our JavaScript Look Like When Using Prototype? 22
2.4 Prototype Jargon and Concepts . . . . . . . . . . . . . . 37
2.5 What Are Prototypes Anyway? . . . . . . . . . . . . . . . 39
2.6 Running Prototype Code Samples in This Book . . . . . 41

3 Quick Help with the Dollars 42


3.1 Shortcuts Should Be Short . . . . . . . . . . . . . . . . . 42
3.2 Quick Fetching of Smart Elements with $ . . . . . . . . 42
3.3 $w, Because Array Literals Are Boring . . . . . . . . . . 44
3.4 $$ Searches with Style . . . . . . . . . . . . . . . . . . . 45
3.5 $A, the Collection Unifier . . . . . . . . . . . . . . . . . . 47
3.6 $F Is a Field Expert . . . . . . . . . . . . . . . . . . . . . 49
3.7 $H Makes a Hash of Things . . . . . . . . . . . . . . . . . 50
3.8 Handling Ranges with $R . . . . . . . . . . . . . . . . . . 50

4 Regular JavaScript on Steroids 52


4.1 Generic Object Manipulation . . . . . . . . . . . . . . . . 52
4.2 Proper Function Binding . . . . . . . . . . . . . . . . . . 58
4.3 Your Functions Actually Know More Tricks . . . . . . . 62
4.4 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CONTENTS 9

4.5 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.6 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.7 Full-Spectrum JSON Support . . . . . . . . . . . . . . . 82

5 Advanced Collections with Enumerable 88


5.1 The Core Method: Iterating with each . . . . . . . . . . . 88
5.2 Getting General Information About Our Collection . . . 91
5.3 Finding Elements and Applying Filters . . . . . . . . . . 93
5.4 Grouping Elements and Pasting Collections Together . 95
5.5 Computing a Derived Collection or Value . . . . . . . . . 99
5.6 Order Now: Getting Extreme Values and Using Custom Sorts 102
5.7 Turning Our Collection into an Array or Debugging String 104
5.8 Enumerable Is Actually a Module . . . . . . . . . . . . . 104

6 Unified Event Handling 108


6.1 Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.2 The Events Hall of Fame . . . . . . . . . . . . . . . . . . 125
6.3 Reacting to Form-Related Content Changes . . . . . . . 127

7 Playing with the DOM Is Finally Fun! 130


7.1 Extending DOM Elements . . . . . . . . . . . . . . . . . . 130
7.2 Element, Your New Best Friend . . . . . . . . . . . . . . 132
7.3 Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.4 Debugging Our DOM-Related Code . . . . . . . . . . . . 168

8 Form Management 173


8.1 Toward a Better User Interface . . . . . . . . . . . . . . . 173
8.2 Looking at Form Fields . . . . . . . . . . . . . . . . . . . 177
8.3 Submitting Forms Through Ajax . . . . . . . . . . . . . . 178
8.4 Keeping an Eye on Forms and Fields . . . . . . . . . . . 183

9 Ajax Has Never Been So Easy 186


9.1 Before We Start. . . . . . . . . . . . . . . . . . . . . . . . . 186
9.2 Hitting the Road: Ajax.Request . . . . . . . . . . . . . . . 192
9.3 Streamlining: Ajax.Updater . . . . . . . . . . . . . . . . . 208
9.4 Polling: Ajax.PeriodicalUpdater . . . . . . . . . . . . . . . 215
9.5 Monitoring Ajax Activity: Ajax.Responders . . . . . . . . 219
9.6 Debugging Ajax . . . . . . . . . . . . . . . . . . . . . . . . 219
9.7 Ajax Considered Harmful? Thinking About Accessibility and Ergonomy 220
CONTENTS 10

10 More Useful Helper Objects 225


10.1 Storing Values in a Hash . . . . . . . . . . . . . . . . . . 225
10.2 Expressing Ranges of. . . Well, Anything You Want! . . . 230
10.3 Periodical Execution Without Risk of Reentrance . . . . 231
10.4 Templating Made Easy . . . . . . . . . . . . . . . . . . . 233
10.5 Examining the Current Browser and Prototype Library . 236

11 Performance Considerations 241


11.1 Element Extension and the $ Function . . . . . . . . . . 241
11.2 Iterations vs. Regular Loops . . . . . . . . . . . . . . . . 242
11.3 Obsolete Event Handlers . . . . . . . . . . . . . . . . . . 243
11.4 Recent Speed Boosts You Should Know About . . . . . . 243
11.5 Small Is Beautiful . . . . . . . . . . . . . . . . . . . . . . 244

12 Wrapping Up 245
12.1 Building a Fancy Task List . . . . . . . . . . . . . . . . . 245
12.2 Laying the Groundwork . . . . . . . . . . . . . . . . . . . 246
12.3 It Takes Only 40 Lines: The JavaScript Code . . . . . . . 248

II script.aculo.us 252

13 Discovering script.aculo.us 253


13.1 The Modules of script.aculo.us . . . . . . . . . . . . . . . 253
13.2 Using script.aculo.us in Your Pages . . . . . . . . . . . . 255

14 Visual Effects 257


14.1 What Are Those Effects, and Why Should We Use Them? 257
14.2 Core Effects . . . . . . . . . . . . . . . . . . . . . . . . . . 259
14.3 Diving into Effects . . . . . . . . . . . . . . . . . . . . . . 265
14.4 Combined Effects . . . . . . . . . . . . . . . . . . . . . . . 269
14.5 Unlocking the Cool Factor: Effect Queues . . . . . . . . 272
14.6 Effect Helpers . . . . . . . . . . . . . . . . . . . . . . . . . 274
14.7 How to Create Our Own Effects . . . . . . . . . . . . . . 276

15 Drag and Drop 283


15.1 Dragging Stuff Around . . . . . . . . . . . . . . . . . . . . 283
15.2 Controlling How It Starts, Where It Goes, & How It Ends 289
15.3 Ghosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
15.4 Dragging and Scrolling . . . . . . . . . . . . . . . . . . . 298
15.5 Monitoring Drags . . . . . . . . . . . . . . . . . . . . . . . 301
15.6 Dropping Stuff . . . . . . . . . . . . . . . . . . . . . . . . 301
CONTENTS 11

15.7 Customizing Drop Behavior . . . . . . . . . . . . . . . . . 302


15.8 Sorting with Drag and Drop . . . . . . . . . . . . . . . . 307
15.9 Common Pitfalls . . . . . . . . . . . . . . . . . . . . . . . 319

16 Autocompletion 323
16.1 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
16.2 Local Autocompletion . . . . . . . . . . . . . . . . . . . . 325
16.3 Getting Ajaxy . . . . . . . . . . . . . . . . . . . . . . . . . 330
16.4 Using Rich-Markup Choices . . . . . . . . . . . . . . . . 334
16.5 Autocompleting Multiple Values in One Field . . . . . . 335
16.6 Reacting to Completion with Callbacks . . . . . . . . . . 339

17 Building DOM Fragments the Easy Way: Builder 343


17.1 Building Explicitly . . . . . . . . . . . . . . . . . . . . . . 344
17.2 Using an (X)HTML Representation . . . . . . . . . . . . . 347

18 In-Place Editing 349


18.1 What’s In-Place Editing Exactly? . . . . . . . . . . . . . . 349
18.2 A Simple Example . . . . . . . . . . . . . . . . . . . . . . 352
18.3 How Can We Tweak the Ajax Persistence? . . . . . . . . 354
18.4 Customizing the Appearance . . . . . . . . . . . . . . . . 355
18.5 Dealing with Multiple Lines . . . . . . . . . . . . . . . . . 363
18.6 Editing Alternative Text . . . . . . . . . . . . . . . . . . . 364
18.7 Disabling In-Place Editing . . . . . . . . . . . . . . . . . . 367
18.8 Offering a List of Values Instead of Text Typing . . . . . 368

19 Sliders 373
19.1 Creating a Simple Slider . . . . . . . . . . . . . . . . . . . 374
19.2 Customizing the Basics . . . . . . . . . . . . . . . . . . . 376
19.3 Restricting Range or Allowed Values . . . . . . . . . . . . 378
19.4 Tweaking an Existing Slider and Adding Controls . . . . 381
19.5 Defining Multiple Values . . . . . . . . . . . . . . . . . . 381

20 Sound Without Flash 386


20.1 Where Does It Work? . . . . . . . . . . . . . . . . . . . . . 386
20.2 How Do We Play Sounds? . . . . . . . . . . . . . . . . . . 387
20.3 Playing Multiple Sounds on Multiple Tracks . . . . . . . 387

A Extending and Contributing 391


A.1 Building Over: Classes, Inheritance, and DOM Extension 391
A.2 Contributing! . . . . . . . . . . . . . . . . . . . . . . . . . 398
CONTENTS 12

B Further Reading 411


B.1 Official Websites . . . . . . . . . . . . . . . . . . . . . . . 411
B.2 Useful Blogs by Prototype Core Members . . . . . . . . . 411
B.3 JavaScript Masters . . . . . . . . . . . . . . . . . . . . . . 412
B.4 Community and New Sites Around Ajax . . . . . . . . . 413
B.5 ECMAScript Intimacy . . . . . . . . . . . . . . . . . . . . 413
B.6 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . 413

C Installing and Using Ruby 414


C.1 On Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 415
C.2 On Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
C.3 On Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . 416
C.4 Running a Ruby Script . . . . . . . . . . . . . . . . . . . 416
C.5 “But I Don’t Know a Thing About Ruby!” . . . . . . . . . 417

Index 418
Preface
Prototype began its life in early 2005 at a time when the name “Java-
Script” still evoked images of pop-up ads, blinking text, and copied-
and-pasted <script> tags in most developers’ minds. Even though web
applications such as Gmail and Google Suggest were showing the world
that JavaScript (and this new thing called “Ajax”) could actually be used
to improve the user experience, implementing these new techniques in
your own apps proved to be painful and frustrating. Each web browser
had its own quirks to work around, and most existing code wasn’t
designed to take advantage of JavaScript’s object-oriented nature or
powerful closure capabilities.
Inspired by the expressiveness of dynamic languages such as Ruby,
we set out to build a browser programming environment that we could
actually look forward to using. We started with a small set of tools that
let us work with classes and functions. Then we extracted common
Ajax and DOM manipulation operations from our existing applications.
In March 2005, we released Prototype 1.0 as part of the Ruby on Rails
framework. Prototype has grown a lot since then, but it remains focused
on providing the best possible environment for JavaScript developers.
As for script.aculo.us, or “Scripty” as it’s affectionately known by the
Core team, it started out as a short section of code in Prototype that
implemented the now-ubiquitous “yellow fade technique.” With a desire
to make web applications more user-friendly—and provide eye candy
that’s really useful to boot—it quickly grew into a complete real-time
DOM-based effects engine, drag-and-drop framework, and controls
library. Version 1.0 was released in June 2005.
You should understand that script.aculo.us is distinct from many other
UI libraries in that it does not try to shield the developer from the
DOM but rather extends and improves the DOM so that developers
and designers can capitalize on their existing knowledge.
P REFACE 14

Combined with Prototype, it’s engineered for building your own widgets,
controls, and basically any artsy awesomeness in less time than it takes
to configure heavier, widget-based frameworks.
To paraphrase the motto of Ruby, the language whose design has heav-
ily influenced our libraries: Prototype and script.aculo.us are “a web
programmer’s best friends.” According to the feedback we’ve received,
we’re not the only ones who feel that way.
Two-and-a-half years after the initial release, Prototype and script.acu-
lo.us are in use on many of the web’s most popular websites and power
all sorts of innovative web applications.
This rapid popular uptake has been possible only through the efforts
of the Prototype Core team, consisting of Seth Dillingham, Andrew
Dupont, Mislav Marohnić, Justin Palmer, Christophe Porteneuve, Tobie
Langel, Scott Raymond, and Dan Webb; the thousands of hours of work
by hundreds of contributors from the Prototype and script.aculo.us
community; and, of course, Christophe, for providing this very book.
Big thanks to all of them and to you.

Sam Stephenson (Creator of Prototype)


October 15, 2007

Thomas Fuchs (Creator of script.aculo.us)


October 15, 2007
Chapter 1

Introduction
Prototype is a wonderful JavaScript library aimed at easing dynamic
web application development. Its close friend, script.aculo.us, provides
a lot of user interface–oriented features with a high wow factor (still),
such as drag and drop, autocompletion, mouse-driven element sorting,
awesome visual effects, and in-place editing. It’s all at your fingertips,
with only a couple lines of script.
The close relation between the two lies in that they both originated in
the Ruby on Rails universe, as Rails “spin-offs.” They are provided with
Rails but can be obtained separately on their official web sites and are
actually backend-agnostic: you can use them over PHP, .NET, J2EE,
Python, Delphi, or anything else that helps you produce dynamic web
pages. And indeed, thousands of developers do just that every day. Also,
script.aculo.us relies on Prototype, and both libraries are written in a
consistent style.
These libraries will, quite simply, rock your world. You will discover, as I
and countless others have, that client-side web page development does
not need to be gruesome, kludgy, or even dull. It can be expressive,
productive, efficient, clean, portable, and intellectually pleasing. It can
call to our technical sense of aesthetics, and most important, it can be
a huge amount of fun.

1.1 It’s About Time


Prototype and script.aculo.us have been around for quite some time
now. According to an Ajaxian.com survey in September 2006,1 they

1. http://ajaxian.com/archives/ajaxiancom-2006-survey-results
I T ’ S A BOUT T IME 16

are by far the two most popular JavaScript frameworks, with whop-
ping 43% and 33% adoption rates, way more than the third contender,
Dojo. With the advent of Prototype’s new official site and comprehensive
online reference documentation in January 2007, it will likely have an
even higher adoption rate by the time this book hits the shelves.
Still, a year ago, both frameworks already were extremely popular. And
what did shelves have to say about it? Nothing. In November 2006,
Scott Raymond and Sergio Pereira produced a 30-page Prototype quick
reference in O’Reilly’s Short Cuts series, but that’s it. The script.aculo.-
us wiki is a good starting point but uses a fairly inconsistent style and is
way out-of-date. As for Prototype, most addicts started out with Sergio’s
unofficial page and then had to dive into the source code to try to figure
out all the neat tricks.
And some source code it is. Both frameworks squeeze all the power
they can get out of JavaScript and are written in a fairly advanced
style. The unfortunate result is that those diving into the code without
serious JavaScript knowledge could very easily become lost, dazzled,
confused, or all of these at once. Although accurate, timely, and polite
answers could be found on the Google Group,2 all users agreed that
some production-quality, official documentation was in order. It is now
available, at least for Prototype, at its official website.3
“This is all well and good,” you might say, “but then what the heck do
I need this book for?” Well, there are several reasons why reading this
book is a good idea:
• This book goes far beyond the documentation available online. It
includes a lot more examples, goes further into details, and pro-
vides a lot more besides the actual reference material: a full-on
tutorial; real-world scenarios and their solutions; and plenty of
extra tips, tricks, best practices, and all-around advice.
• You may well want to leverage passive offline time to learn. This is
about reading on the bus, in the subway, or in the passenger seat
in a carpool highway lane.
• Even active offline time needs a book, such as when you’re work-
ing on your laptop in a train or plane.

2. http://groups.google.com/group/rubyonrails-spinoffs
3. http://prototypejs.org
W HAT ’ S IN T HIS B OOK , AND H OW I S I T O RGANIZED ? 17

• Like many people, you may just like having the physical copy of
the book close at hand. It just is nicer to the eye than on-screen
text, you know?
I discovered Prototype and script.aculo.us in late 2005 and dived into
them for real around June 2006 (since my early perusal had made me
fall in love with them) when I was writing my first book, Bien dévelop-
per pour le Web 2.0, which featured rather detailed coverage of them
through dedicated chapters. I loved the code I saw, I loved the code
I could write, and I started contributing heavily to the Google Group
and then the official documentation site. So if you find examples in
this book that also appear online, this is no accident. I may well have
written the online page. And at any rate, when you have a very good
example available, you just use it.

1.2 What’s in This Book, and How Is It Organized?


The book is organized in three parts: the case-study tutorial, the Pro-
totype reference, and the script.aculo.us reference. These are not refer-
ences in the usual sense of the term, which generally implies a rather
dry series of object and method descriptions sprinkled with laconic
snippets of code. These references are written like books unto them-
selves, arranged by topics, and they devote plenty of time and effort to
providing background, explaining concepts, detailing the architecture,
and helping you grasp the big picture as well as the details.
Both reference parts open with an introductory chapter; these are
Chapter 2, Discovering Prototype, on page 21 and Chapter 13, Discover-
ing script.aculo.us, on page 253. They’re here to help you dip your foot
and test the waters. Then they tackle the library by topic, in roughly
prioritized order, with the most critical appearing first. This is actually
not a straight rule; for instance, in script.aculo.us, features are orthog-
onal, so you can study them in any order. I decided to go first with what
seems most useful and perhaps brings the most fun.
This book is, quite simply, the comprehensive reference for these two
libraries, with enough extra stuff to help you actually master them, be
able to extend them for your own needs, or even contribute to them.
This is the single book you need to become a Rails spin-offs guru.
Doesn’t that sound good? Of course it does.
A CKNOWLEDGMENTS 18

Some Things This Book Doesn’t Specifically Address


Although Prototype helps and encourages best practices such as unob-
trusive JavaScript, better accessibility, and so on, it does not guarantee
it at all: it’s a tool, not a process.
I am personally very fond of JavaScript accessibility and the narrower
subject of Ajax accessibility. I discussed them at length in my previous
book, Bien développer pour le Web 2.0, which is, however, not available
in English so far. . . . But the focus of this book is Prototype and script.-
aculo.us, which makes it a sizeable book as it is. To stay focused and
avoid straying too far afield, I won’t cover the details of such general
matters, which can be tackled and honored with any set of tools, as
long as your development process embraces the right constraints.

Who Is This Book For?


This book is essentially for any JavaScript developer interested in fully
leveraging the power of these two wonderful libraries: Prototype and
script.aculo.us. I expect that you have at least a decent understand-
ing of JavaScript (although you may not master its tricky details) and
(X)HTML, as well as basic knowledge of the DOM and CSS. That’s all
you’ll need, really! Whenever we tread in deeper waters, I’ll try to help
you wade through by explaining whatever details are relevant.

1.3 Acknowledgments
Writing a book is no walk in the park. It takes time, effort, dedication,
steadfastness, and a tremendous amount of help and support.
I cannot thank Pragmatic Programmers enough. These guys take you
through a book-writing journey that leaves you loathe to write for any-
body else. As publishing goes, they’re the bleeding edge and a real mag-
net for technical writers with a soft spot for efficiency and cool tool
chains. My heartfelt thanks especially to Dave Thomas, Andy Hunt,
and Daniel H. Steinberg. You’re putting the word editor into a whole
new perspective and a wonderful one at that.
I would also like to express my undying gratitude to my copy editor,
Kim Wimpsett, who did a wonderful job with enormous insight and
attention to detail; to my indexer, Sara Lynn Eastler, who produced the
outstanding, Pragmatic-Bookshelf-quality index at the end of this book;
and to my typesetter, Steve Peter, who provided all the final touches that
make it all look so prim.
A CKNOWLEDGMENTS 19

Before all this started, I asked Justin Palmer if I could step in his shoes
and write this book for Pragmatic Programmers. Not only was he very
gracious about it, but he got me on board with the Prototype documen-
tation effort and later with Prototype Core. It has been an amazing ride
so far. Thanks a bunch, Justin.
This book would be an order of magnitude less pleasant to read if it
were not for the keen eyes and minds of its reviewers, both “live” and
at the final draft stage. I am deeply in the debt of Stéphane Akkaoui,
Arnaud Berthomier, Craig Castelaz, Seth Dillingham (Prototype Core),
Tom Gregory (a prominent voice on the official mailing list), Sébastien
Gruhier (of Prototype Window Class fame), Amir Jaballah, Tobie Langel
(Prototype Core), Justin Palmer (again), and Sunny Ripert. Many read-
ers also got onto the bandwagon at the beta stage and went so far as to
report a number of typos, errata, and the like. Among those, I’m espe-
cially grateful to Steve Erbach, Brandon Kelly, and “DarkRat” (whose
real name I’m sorry not to know), who’ve been particularly helpful.
Sam Stephenson (creator of Prototype) and Thomas Fuchs (creator of
script.aculo.us) first deserve the highest accolade for having churned
out those two libraries. The groundbreaking nature of their work can-
not be emphasized enough, and the immense satisfaction they have
brought to countless web developers commands respect. When it comes
to this particular book—the first ever focusing in depth on their babies!
—they not only revised the final draft but also agreed to write the pref-
ace, for which I cannot help but feel honored. Working with them is a
privilege and a very fun ride, and I take this opportunity to thank them
thrice over: for the libraries, for the review, and for the preface.
Élodie Jaubert, my fiancée, took admirably well to this second book-
writing endeavor, barely four months after the previous one ended. She
showed wonderful patience and support through the eight months it
took to write and edit this one, bearing with quite a few late evenings
and afternoons I spent writing at my desk, pushing me ahead, and giv-
ing me strength and love at all turns. I could not dream of more. This
book is for her.
Part I

Prototype
Discovering Diverse Content Through
Random Scribd Documents
a suitable flux. Crystallites are not uncommon in the melted
peripheries, as may be seen in a hard-burnt brick in ordinary light.
Mica.—In minute flakes, shining, or glistening, and commonly
black, silvery or bronze-coloured.
A. Detected at once by its thin shining scales, which frequently
have not suffered much in the kiln except near the outside of the
brick.
B. 1—The darker micas are usually citron coloured or light
brown, and unless cut parallel to the cleavage of the mineral, exhibit
a number of closely-set parallel lines, the fragments being much
“frayed out” and “ragged” at the edges. 2—Using one nicol only, the
mineral changes from dark to light on the revolution of the stage,
and is said (in common with other minerals exhibiting a similar
property) to be dichroic. With both nicols in position but little further
difference is noted, except that in changing tint the whole is darker.
Vivid colours are not observed except in yellows and browns.
Muscovite mica is often quite white and transparent.
Iron.—Common except in white bricks made from the purest
china-clays.
A. Brown or reddish-brown specks; sometimes as blue black
films in fire-bricks; dull and frequently powdery in common bricks.
Surrounding, film-like, grains of mineral matter of which the brick is
composed. A grain of quartz, for instance, is frequently seen
enveloped by a film of red iron. Other metallic iron is more lustrous
and whiter than magnetite when seen in reflected light, but such
unaltered particles of the mineral could only occur in a brick that had
not been subjected to great heat.
B. Opaque either in 1 or 2.
Iron Pyrite only occurs as such in bricks that have not been
thoroughly burnt, or in common “baked” bricks. Higher temperatures
lead to the separation of the iron from the sulphur and the general
incorporation of both in the agglutination of the brick during partial
fusion.
A. Brassy yellow particles.
B. Opaque both in 1 and 2.
Calcite.—Not found in burnt bricks, nor indeed in any except
those that have been sun-dried, or have been subjected to very little
heat. Small pellets of lime are of common occurrence in poorly-burnt
bricks. In reflected light such pellets are generally of a dirty white
tint; opaque in transmitted light.
Dolomite.—Practically the same observations apply as to calcite,
crystals of dolomite not being found except in sun-dried bricks and
the like. Under the action of much heat the mineral, like calcite, is
reduced to lime.
Selenite.—This is not rare in the commoner class of bricks,
though the application of much heat reduces it to the state of
powder. In reflected light it is found to be present as extremely
minute specks or “tears” of whitish powdery plaster. Opaque, of
course, in transmitted light.
The description of the micro-appearance of many other minerals
which occur but rarely in bricks does not fall within the scope of the
present elementary treatise; for practical purposes they may be
ignored.
CHAPTER XIII.

ABSORPTION.

The advantage of knowing the relative absorptive capacity of


bricks has been stated in these pages in divers connexions. The
means of arriving at the total capacity for absorption of water, as
generally practised by experimenters, are very incomplete and
founded on an erroneous principle. It is admitted by all that
absorption is one of the very best tests as to the quality of a brick,
but such tests are meaningless unless they imitate one or other or
several of the influences to which the brick would be subjected on
being used in the building, or other structure.
A common method is to weigh the brick when dry and then to
immerse it in water for periods varying from one to three days,
subsequently re-weighing it, the difference in weight between the
dry and wet states being termed the brick’s “absorptive capacity.”
16
Mr. Heinrich Ries remarks that the absorption is determined by
weighing the thoroughly dry samples, immersing in clean water from
48 to 72 hours, then wiping dry and weighing again. Vitrified bricks
should not show a gain in weight of over 2 per cent. There are cases
where bricks of apparently good quality shew a greater absorption
than this, but they have great toughness and refractory qualities.
Bricks made from fire-clays which will not vitrify so easily will,
naturally, show higher absorption.
Again, Mr. E. S. Fickes, of Steubenville, Ohio, has recently
17
made a large series of valuable tests of both paving and building
bricks, in which he shews the connexion between the power of
absorption and the strength of the materials experimented with. Mr.
Fickes’ more important conclusions are:—
1. The strength of the building brick, both transverse and
crushing, varies in tolerably close inverse ratio with the quantity of
water absorbed in twenty-four hours. The strongest bricks absorb
the least water.
2. Good building bricks absorb from 6 to 12 per cent. in 24
hours, and with no greater absorption than 12 per cent. will
ordinarily show from 7,000 to 10,000 or more pounds per square
inch of ultimate crushing strength.
3. Poor building bricks will absorb one-seventh to one-fourth of
their weight of water in 24 hours, and average a little more than
one-half the transverse and crushing strength of good bricks.
4. An immersed brick is nearly saturated in the first hour of
immersion, and in the remaining 23 hours the absorption is only
five-tenths to eight-tenths of 1 per cent. of its weight, as a rule.
These experiments are of much interest and are probably
approximately correct; but we venture to think that if the absorption
experiments had been carried out in a different manner, the results
would have been still more valuable.
Long before the publication of the results of the last mentioned
series of experiments, the present writer had discovered the close
connexion which subsists between the relative absorptive capacity of
bricks and their strength; a slight correction must be applied for
specific gravity. We are not prepared to enter into this subject at any
length, but it may be observed that we should not have arrived at
such close results had we experimented in the same way as the
American authors just quoted (or others, for the matter of that).
When you completely immerse a brick in water you prevent the
escape of air to a very large extent from the pores in the interior of
the brick. An old-fashioned way of overcoming this difficulty, was to
place the brick in the receiver of an air-pump and exhaust the air,
subsequently immersing the brick. This latter method certainly
possessed the merit of enabling the experimenter to arrive at total
absorption very rapidly, but it did not imitate natural processes any
more than does the thorough immersion of the brick in water.
A writer in the Builder of May 25th, 1895, p. 397, experimented
as follows:—The bricks were placed in water in a large vessel, on
edge, supported where necessary by flat blocks, to bring the
uppermost face of each brick about ¼-inch above the surface of the
water. Experience had shewn that by completely immersing a brick,
the air did not get an opportunity of escaping from its pores with the
same facility as when one surface was left out of water. This
disability, it was found, materially impaired the results of the rate of
absorption (rate, as well as total tests, being carried out). By
arranging the experiments in the manner described, there can be no
doubt that each brick absorbed the maximum quantity of water
possible; at any rate, there was no water-pressure from above to
retard the expulsion of the air.
The tests in the last-mentioned case extended over one week,
the relative absorption being taken at intervals of 1 second, 1
minute, 30 minutes, 1 day, and at the end of the week. It was found
that English vitrified bricks absorbed from 1.16 to about 1.85 per
cent. in one week; white glazed and good red and blue facing bricks
from 5.31 to 10.34 per cent. in one week; wire cut facers and
rubbers, with white gaults, imbibed as much as from 12.93 to 20.50
per cent. of their dry weight in one week. The rate of percolation
suggested many interesting problems, not the least important being
the effect of chemical decomposition in prolonged immersions,
whereby after being quiescent for a few days (after taking in the
water for a few hours), absorption “burst out” again and continued
to the end of the week. One thing is very apparent from this,
namely, that for the lower grade brick even an immersion for one
week is not sufficient for practical purposes. The writer remarks,
“some of the red bricks from Bracknell, being placed in the vicinity of
the white gault bricks (in the water), discoloured the latter to such
an extent as to disfigure them. It was not merely a surface
colouration; it extended to at least ¼-in. into the interior. The red
colouring matter was iron, but there was not enough of it by weight
dissolved to materially interfere with the experiments. This very
clearly shews, however, the folly of erecting a building coursed with
white and red bricks, when both are very absorbent and the red has
so little hold of the iron of which it is partly composed—unsightly
stains are bound to appear.”
This question of the solubility of certain ingredients of bricks, has
not received the attention it deserves; and closely connected with
that is gradual decomposition, whereby the brick becomes more and
more porous—a potent factor in its ultimate destruction.
C H A P T E R X I V.

STRENGTH OF BRICKS.

A very great deal is known concerning the strength of bricks. In addition to


the innumerable experiments carried out by public bodies, we have the results
of painstaking investigation by professors in universities and colleges, and the
results carried out for and published by brickmakers themselves. Yet another
large series of results have been published from time to time by professional
journals, and it is, indeed, to these that we must look (at any rate in Britain)
for anything like detailed work. The “Minutes of Proceedings of the Institution
of Civil Engineers,” the “Transactions of the Royal Institute of British
Architects,” the “Proceedings” of several allied provincial architectural
societies, the “Builder,” the “British Clayworker,” builders’ “Price Books,” and
several engineering “Handbooks,” have all contributed to our knowledge in
regard to the strength of bricks. Of works consecrated entirely to the subject
there are none—applied to British materials; but we have that excellent text-
book by Professor Unwin, F.R.S., “The Testing of Materials of Construction,”
and the important work by Mr. David Kirkaldy, both of the greatest possible
value as being the results, largely, of original work. The experiments of recent
years have been made almost exclusively by Mr. David Kirkaldy at his works in
Southwark; by Professor W. C. Unwin at the Central Institution of the City and
Guilds of London Institute; and by the Yorkshire College, Leeds.
With such a wealth of information a whole treatise might profitably be
written, but it will be understood that in a small work like the present we can
only give a comparatively few results, prefaced by observations to impart a
general idea.
With the strength of brickwork, it is different, and it would seem rather
remarkable, at first sight, that architects and engineers, who are every day
using thousands of bricks, should have been at little pains to ascertain the
“safe load” which this or that brick pier or wall would carry. Experience is, of
course, of great value in all work of that description; but there is always the
lurking suspicion that the engineer is making his piers too big, and that the
architect is by no means running the thing close. The real reason why so little
has been done to test the strength of brickwork is the difficulty in getting
machines of such capacity as would crush sufficiently large masses. Small
piers have been built from time to time, and bricks embedded in putty for
mortar have served their purpose, but practically nothing of a really serious
nature was carried out in Britain until a few months ago. The science
committee of the Institute of Architects, well knowing the advantage of
information as to the strength of brickwork, have partially carried out a most
elaborate series of experiments, the first fruits of which have already been
published, but it would be out of place to allude to them here. When the
remaining brickwork shall have been built long enough at the experimental
station, the final experiments will be made, and the results will, we have no
doubt, be the most important contribution to our knowledge concerning the
strength of brickwork that has ever been published in the kingdom.
But we must give our attention solely to the strength of bricks. To begin
with, we must deprecate the idea that experiments as at present carried out
give anything like the actual strength of bricks—the results are generally
either too high or too low. Neither are the results comparative, except to a
limited extent. One kind of brick has a “frog” on one side, another is recessed
on both sides, a third is stamped with the maker’s name, or some device by
way of trade mark, a fourth is as flat on all sides as may be, a fifth is pressed,
a sixth is hand made, and a seventh wire-cut, and there are many other
varieties of make. With such different kinds it is next to impossible to arrive at
comparative data that shall be of much use for working purposes. Again, the
whole brick may be subject to the experiment, or only the half-brick. The
faces placed between the dies of the crushing machine may not be flat, and
they are most frequently irregular. If the dies are applied to such bricks it is
evident that corners will be broken off before the brick has really suffered
much, and that to get the best result the faces must either be made perfectly
true and parallel to each other, or some other method adopted to put matters
right. That commonly employed is to place some yielding substance between
the faces and the surface of the dies. Sometimes thin sheets of lead or pine
wood are inserted. Professor Unwin has the faces of the brick made smooth
and parallel by means of plaster of Paris, and the brick is then crushed
between two pieces of millboard or between the iron pressure-plates, one
plate having an arrangement to allow for any slight want of parallelism
between the two surfaces of the brick applied to the plates.
Now it will be obvious, what with the difference in the shape and the
various modes of experimenting, that the results are by no means
comparative unless the precise facts are given; and when they are, it is but
rarely that you can find more than half-a-dozen or so kinds of bricks of each
category that offer all the elements necessary for comparison. So that, with all
the wealth of information, we are by no means laden with much that is of
actual comparative value, and if the experiments and their results are not
comparative, of what use are they? So long as experimenters are each
allowed a different method of research, and so long as makers will have
partial or whole “frogs,” will stamp their names or initials, or will produce plain
bricks only, so long will it be impossible to arrive at the best results that are
really attainable. What we want is a government testing station as they have
in Germany; or, at least, the mode of experimenting should be under some
central control. The experimenter, further, should select the samples to be
crushed, and should be at liberty to publish all results obtained. At present, if
the brickmaker does not like the results arrived at, he, of course, does not
publish them. And, if he has had a number of experiments carried out from
time to time, he will, usually, quote only the highest results on his bricks. That
is perfectly natural, and would be understood as “business.” All brickmakers
may not do that, and a few may publish every or average results (we do not
mean of one set of experiments, on say six bricks) of different experiments,
but we fancy they are very rare. Therefore, in a matter so important to the
architect and the engineer, and indeed to the general public, from the point of
view of safety, we maintain that the whole thing should be carried out under
some central control, as on the continent.
And now to proceed with the description of results on a few typical bricks.
Glancing at table I, we may say that the strength of bricks as a whole is often
quoted as here given, and has done duty for many years as the average
strength of bricks. These bricks were crushed in a Clayton machine, and all
were bedded upon a thickness of felt and laid upon an iron faced plate, and
the experiments were conducted by the Metropolitan Board of Works.

Strength of Bricks.—I.

Pressure in tons
Description. to

Crack. Crush.

Four white bricks, each 16.25 41.00


Three „ „ „ 17.05 41.05
Red bricks, ordinary 13.00 26.25
Red bricks, not well
burned 13.75 25.05
Best Paviours 14.00 23.00
Grey Stocks, London 12.00 14.00

Turning to the second table, compiled for the most part from brickmakers’
circulars, and from the original results obtained for the late Building
Exhibition, at the Agricultural Hall, all the experiments, we believe, having
been carried out by Mr. David Kirkaldy, it will be noted that great variation in
strength is apparent, following the different kinds of bricks. The highest
result, 1064.2 tons per square foot, was obtained on a blue Staffordshire
brick, though that is very closely run by bricks made from slate débris (1056.2
tons) from South Wales. The lowest result, 139.5 tons per square foot, was
from a Worcester brick.

Strength of Bricks.—II.

Mean stress of
six samples in
Dimensions,
Locality. Description. tons per square ft
Inches.
Cracked Crushed

West Bromwich Blue 2.74, 9.03 ×


4.36 548.6 1064.2
„ „ Blue (another 2.80, 8.75 ×
make) 4.12 260.7 651.0
„ „ White glazed,
3.10, 8.80 ×
“Terra
4.22
Metallic,”
3.16, 8.70 × } 225.0 273.7
recessed
4.34
both sides
„ „ Blue vitrified 2.55, 9.03 ×
4.30 245.1 654.9
Worcester “Pressed,” 3.20, 9.14 × 65.0 139.5
recessed 4.50
top and
bottom
„ “Builders.”
3.20, 9.30 ×
recessed top 56.1 155.5
4.50
and bottom
Saltley, Birmingham Red, recessed 3.20, 8.90 ×
one side 4.35
3.25, 8.95 × } 138.7 180.5
4.40
Rowley Regis, Blue vitrified 2.85, 8.75 ×
385.6 722.7
Staffs. no recess 4.20
Leicester Red, recessed 2.65, 8.90 ×
both sides 4.25
2.75, 9.10 × } 105.9 150.6
4.36
Napton-on-the-Hill, Light brown, 2.85, 8.92 ×
Rugby wire cut 4.20
2.90, 9.10 × } 131.6 303.9
4.25
Ruabon Red, no recess 3.10, 8.75 ×
4.28
3.15, 8.73 × } 439.2 676.8
4.29
„ Blue, no recess 3.02, 8.99 ×
4.37
3.01, 8.95 × } 358.9 561.2
4.36
Glogue, Whitland, 2.33, 8.70 ×
Slate débris 556.4 1056.2
S. Wales 4.25
Ravenhead, St. Red, brown 2.90, 9.00 ×
Helens, Lancs. wire cut 4.20
2.90, 8.90 × } 215.8 354.7
4.27
Earith, St. Ives,
Hunts.
Yellow, wire cut 2.50, 8.70 ×
4.10
} 135.9 178.8
2.50, 8.80 ×
4.20
Gillingham, Dorset Red, wire cut 2.60, 8.90 ×
4.30
2.60, 8.90 × } 159.5 261.7
4.25
Newton Abbot, Vitrified “granite” 2.80, 8.90 ×
Devon 4.35
2.80, 9.10 × } — 445.2
4.55

18
Table III. is by Professor Unwin, and records the strength of several
well-known bricks. Professor Unwin’s mode of experimenting we have already
alluded to.

Strength of Bricks.—III.

Cracked, Crushed
Dimensions. at tons at tons
Description. Colour. Remarks.
Inches. per sq. per sq.
ft. ft.
London stock 4.6 × 4.1 × 2.4 128 177 Yellow Half brick
„ „ 4.6 × 4.0 × 2.45 133 181 „ „
„ „ 9.2 × 4.1 × 2.8 — 129 „
„ „ 8.9 × 4.2 × 2.3 — 113 „
„ „ 8.9 × 4.25 × 2.5 — 103 „
Aylesford, 8.9 × 4.4 × 2.7 48 183 Pink
common
„ „ 8.9 × 4.4 × 2.7 111 228 „
„ 9.1 × 4.3 × 2.7 71 141 Red Deep frog
pressed
Rugby, 9.5 × 4.2 × 2.9 158 190 „ {Between}
common
„ „ 9.0 × 4.2 × 3.0 — 120 „ {pine
bds.}
Lodge Colliery, 9.0 × 4.2 × 3.4 127 159 „
Notts
„ 9.0 × 4.2 × 3.25 55 122 „

Digby Colliery, 9.3 × 4.1 × 3.25 248 [353] „ Not
Notts crushed
„ 4.6 × 4.2 × 3.2 414 414 „ Half brick

Ruabon, 8.8 × 4.3 × 2.7 361 [361] „ Not
pressed crushed
Grantham, wire 9.2 × 4.4 × 3.2 — 83 „
cut
Leicester, „ 4.4 × 4.1 × 2.6 251 337 Pale red Half brick

„ „ 4.3 × 4.1 × 2.6 109 308 „ „

„ „ 9.06 × 4.2 × 2.8 115 229 „

Cranleigh, 4.7 × 4.6 × 2.5 149 181 „ Half brick
pressed frog.
„ „ 4.6 × 4.6 × 2.5 165 237 „ „ „„
Candy, pressed 8.8 × 4.3 × 2.8 80 381 —
Gault, wire cut 8.7 × 4.1 × 3.0 111 173 White
„ „ 4.4 × 4.2 × 2.5 119 145 „ Half brick
„ „ 8.7 × 4.1 × 2.9 — 169 „
Staffordshire 4.5 × 4.3 × 3.0 216 464 Blue „
blue,
common
„ „ „ 4.3 × 4.2 × 3.0 152 386 „ „
„ „ „ 8.9 × 4.3 × 3.1 240 [353] „ Not
crushed
Staffordshire 9.0 × 4.3 × 3.1 — 275 „
blue,
pressed
Glazed brick 8.8 × 4.4 × 3.3 69 166 — Frog.
„ „ 8.9 × 4.4 × 2.9 166 174 —

Table No. III. is specially instructive as indicating the relative strength of


several well-known bricks, the experiments being carried out solely for
scientific purposes. Yet the figures must not be taken too seriously. Glancing
at those relating to “London Stocks,” we find the strength varied from 103
tons per square foot to 181 tons. But more recent experiments made by
19
Professor Unwin on some London Stocks from Sittingbourne, in Kent,
shewed that with four samples one crushed at 60.76 tons per square foot and
another gave out 94.6 tons, the mean strength of the four yielding 84.27 tons
per square foot. With such heterogeneous materials as London Stocks, we
ought not to be surprised at these results, but they form a striking
commentary on the value of general statements concerning the strength of
bricks of varied character going by the same name in the market.
When we consider the strength of homogeneous bricks, and especially
where these latter are made of thick marine clays, or where the relative
proportions of earths employed are carefully attended to in the raw material,
the results appear to be more generally applicable—as far as they go.
With ordinary Gault bricks we find a range in strength from 145 tons to
20
173 tons per square foot; but Professor Unwin, in his more recent
experiments, finds that of four Gault bricks, one reached as high as 197.6 tons
per square foot, and he gives 182.2 tons as the average strength.
To shew the absurdity of alluding to the strength of “blue Staffordshire”
bricks, without also giving the precise locale of the samples dealt with, the
reader is requested to refer to Table III., where the figures indicate a range
from 275 tons to 464 tons per square foot, and to compare them with the
results on Staffordshire bricks as stated in Table II., where we find a range
from 651 tons to 1,064.2 tons per square foot. Of what value can a single
formula be which gives the strength of Staffordshire bricks as a whole as
based on such widely divergent figures as these? Professor Unwin, in his
recent series of experiments alluded to, finds that with four Staffordshire blue
bricks, the weakest gave a result of 564.8 tons per square foot, and the
strongest 788 tons; the mean of the four being 701.1 tons per square foot.
The results on the Leicester “reds” are no more encouraging; the figures
in the foregoing tables are 150.6 tons, 229 tons, 308 tons, and 337 tons per
square foot. Similarly, Professor Unwin has more recently found that the
Leicester “reds” from Elliston, near Leicester, bear a crushing strain varying
from 311.4 tons to 591.4 tons per square foot in four samples.
From the foregoing it will appear to the reader that average results are of
very little value to the architect or engineer, unless—(1) the brickyard is
mentioned from which the bricks experimented with came; (2) the particular
class of brick from that yard; (3) the method of experimenting, as to whether
any substance was placed between the dies of the press and the brick to be
crushed, and if so, what; (4) if recessed or initialled; (5) whether machine or
hand made, and (6) as to whether the surfaces of the bricks were concave,
convex, or flat.
Results on bricks not localised are not of much value, and it is absolutely
useless for working purposes to give in one figure the strength of “London
Stocks,” “Staffordshire blues,” “Leicestershire reds,” and the like. In a general
way, of course, it will be admitted that the “Staffordshire blue” is a stronger
brick than the “London Stock,” and so forth; but that is as much as can be
permitted—it is of no practical use to give relative figures in general terms.
It frequently happens that the capacity of the machine used for testing
the strength of bricks is not enough for those bricks having a very high
resistance to crushing. In the recent experiments by Professor Unwin, more
than once alluded to in this article, it was found necessary to experiment with
half-bricks only, and he ascertained that bricks tested as half-bricks shew
about 25 per cent. less resistance per square foot than when tested as whole
bricks.
Further observations on strength are made under the next heading in
connexion with other forms of testing the value and physical properties of
bricks.
C H A P T E R X V.

ABRASION, SPECIFIC GRAVITY.

Abrasion.—In this country it is not customary to test bricks and


stone by means of the abrasion process, though many English
materials have been dealt with in this manner on the continent.
Abrasion tests are of special value in regard to paving bricks,
and this mode of experiment is largely carried out in the United
21
States. As Mr. H. Ries remarks, the abrasion test approximates
closely the conditions under which the paving brick is used, and is,
therefore, an important one. The usual method of conducting this
test is to put the bricks in an ordinary “foundry rattler,” filling it about
one-third full. It is then rotated at the rate of about 30 revolutions
per minute, and about 1,000 turns are sufficient. The bricks are
weighed before and after to determine loss by abrasion.
A more recent modification is to line the “rattler” with the bricks
to be tested and then put in loose scrap iron. This is claimed to give
more accurate results, and avoids loss by chipping due to the bricks
knocking against each other, as in the previous method, although
that has been somewhat obviated by Professor Orton, jun., by the
introduction of a few billets of wood into the rattler.
The abrasion test may also be made by putting the weighed
bricks on a grinding table covered with sand and water, and noting
the weight before and after grinding. This last method seems to us
to be decidedly the best, provided the bricks be weighted, that the
weight is constant, that the feed of sand and water is uniform, and
that the bricks to be tested are placed equidistant from the centre of
the turning table. If this last point be not attended to, it will be
obvious that in course of the revolutions the sand will tend to
accumulate towards the centre of the table, and the bricks placed in
that vicinity would receive more than their fair share of abrasion, as
compared with those bricks situated near the edge of the table.
Conversely, those bricks near the periphery would be subjected to
greater grinding action, from the circumstance that the table would
move faster underneath them than under those bricks nearer the
centre of the table.
The bricks should certainly be weighted in such abrasion tests,
and it seems desirable that the weights should be so adjusted that
the weight of the brick is also taken into account. It is obvious that
the abrading action of, say, street traffic, will be the same on a brick,
no matter what the latter weighs, depending on the area of surface
exposed to traffic. And if we experiment with one brick, weighing
say 7 lbs., and another weighing 14 lbs., the greater weight of the
latter, will (cæteris paribus), by the abrasion tests as usually
adopted, give a much higher result than would the lighter brick. On
the other hand, if the 7 lbs. brick be weighted another 7 lbs., then
the results would be strictly comparable, provided always that the
area exposed to abrasion in each case be the same, and that the
other conditions we have laid down are strictly observed.
Knowing as we do that the rough and ready method of “rattling”
cannot possibly give truly comparative results, we do not intend to
enlarge much on the results of the American tests; but the following
are suggestive as shewing the connexion between the tests for
absorption, rattling, and strength combined.
Some valuable and interesting tests were recently made by the
Ohio Geological Survey, to determine the relative merits of fire-clays
and shales for the manufacture of paving bricks, as well as the
influence, if any, of the method of manufacture adopted. Twenty-two
varieties of shale bricks, or bricks the largest constituent of which is
shale, were grouped together: fifteen varieties of fire-clay brick; four
varieties composed of shale and fire-clay mixed in equal proportion;
and three varieties made from Ohio River sedimentary clays. The
averages of these four classes of results were as follow:—

Tests of Fire-clay and Shales.—Paving Bricks.

Absorption. Rattling. Crushing.

Square Cubic
Inches. Inches.
Shales 1.17 17.61 7,307 1,764
Fire-clay 1.62 17.32 6,876 1,678
Mixture 1.44 18.72 5,788 1,400
River Clay 1.36 19.02 4,605 1,176

22
From a series of tests recently made by Mr. Fickes, the
following factors were educed:—
1. A brick which stands the “rattling” test well, has ample
crushing strength and rarely chips under less than 5,000 lbs. per
square inch, or crushes under less than 10,000 lbs. The crushing
strength tends to vary with the resistance to abrasion, however, but
more slowly and irregularly.
2. The transverse strength also tends to vary with the resistance
to abrasion, but more slowly and irregularly.
3. The toughest bricks usually absorb the least water.
Specific Gravity.—The practical value of knowing the specific
gravity of a brick has, perhaps, been a little over-rated by writers on
the subject. At the same time we do not deny that there is some use
in ascertaining this property. Foremost, we have to mention its value
in conjunction with absorption in arriving at a rough and ready
means of gauging the strength of a brick, without having actual
recourse to the crushing machine. It appears to us, however, that
the specific gravity of bricks is rarely quoted in a proper manner, and
until there is one uniform method, the results will always be at a
discount. We allude to the fact that some experimenters take the
specific gravity of a porous brick, without stating whether the
amount of water absorbed, during the process, was taken into
account in arriving at the specific gravity or not. Theoretically, of
course, the substance to be dealt with is non-porous, and
experimenters, worthy the name, either render the brick waterproof,
or, ascertaining the amount of water the brick has absorbed, take
that into consideration in calculating results.
The writer is in the habit of quoting the specific gravity in two
ways, viz.: (a) the true specific gravity, and (b) the specific gravity of
the particles. In an elementary treatise like the present, however, it
is not desirable to enlarge on this subject.

THE END.
F O OT N OT E S
1
This, and all other technical terms used, will be
explained in an alphabetical glossary at the end of the
book.
2
“Canal and River Engineering,” p. 315.
3
See, Geikie’s “Text Book of Geology,” 1882, p. 72.
4
Information on this subject will be found in Mr. J. H.
Collins’ work, “The Hensbarrow Granite District.” Truro,
1878.
5
“Text Book of Geology,” 1882, p. 85.
6
“Aids in Practical Geology,” 1893, page 36.
7
See E. S. Dana, “Minerals and How to Study Them,”
1895, p. 154.
8
Consult “Applications of Geology,” etc., by Prof. Ansted,
1865, p. 116, et seq.
9
“Industrial Resources of the Tyne, Wear and Tees,”
1864, p. 204.
10
R. H. Scott, “Elementary Meteorology,” 1883, p. 137.
11
Report of British Association for 1846, Part II., p. 17.
12
Geological Magazine, N.S., Dec. III., Vol. V, 1888, pp. 26
et seq.
13
Such as “The Study of Rocks,” by F. Rutley: “Aids in
Practical Geology,” by Prof. Grenville Cole; “Tables for
the Determination of the Rock-forming Minerals,” by
Prof. Lœwinson Lessing; “Petrology for Students,” by A.
Harker; and especially “Microscopic Physiography of the
Rockmaking Minerals,” by Rosenbusch (transl. Iddings).
14
Consult the works on petrology previously mentioned.
15
The mode of preparation of thin rock sections for
examination by the microscope is described in much
detail in the works of Mr. Rutley and Professor Cole
previously alluded to; also in “Outlines of Field Geology,”
by Sir Archibald Geikie, 1882, p. 202 et seq.
16
16th Ann. Rep. U. S. Geol. Surv. (1894–95), pt. IV., p.
532.
17
16th Ann. Rep. U. S. Geol. Surv. (1894–95), pt. IV., p.
539.
18
“Testing of Materials of Construction,” 1888, p. 438.
19
British Clayworker, April, 1896, Supplement, p. iv.
20
Op. cit. p. iv.
21
16th Ann. Rep. U.S. Geol. Surv. Pt. IV., 1895, p. 532.
22
Engineering News (U.S.), Dec. 13th, 1894.
INDEX, &c.

Abrasion tests, 146


Absorption of bricks, 132
Acids defined, 76
Actinolite, 69
Air, chemical composition of, 105
Albite felspar, chemical composition, 34
Almandite, 68
Aluminium, under blowpipe, 73
Anorthite felspar, chemical composition, 34
Aragonite, 49

Bases defined, 76
Basic bricks, 90
dolomite for, 55
magnesite for, 56
Biotite mica, 43
under blowpipe, 73
Black bricks, 101
Blowpipe, 58
Blue bricks, 101
Bluish-black brick-earths, 27
Boulder clay, 50
Bourges, Oxford clay of, 24
Bovey Heathfield clays, 20
Bracknell bricks, 135
Brick earths, artificial mixing, 42
artificial mixtures, 94, 95
bluish-black, 27
boulder clay, 50
brown, 27
chalk pebbles in, 50
changes in character on being dug into, 2, 5, 10
chemical composition of, 23, 52, 83, 84, 85
chemistry of, 58, 75
chert in, 41, 42
coprolites found in, 51
Cornwall, 35
Crayford, 1
Devon, 35
Erith, 1
estuarine, 21
fluviatile—Chapter I., 1–16
fossil shells in, 50
Ilford, 1
Kimeridge clay, 26
lacustrine—Chapter II., 17–21
Lincolnshire, 21
London clay, 33
marine, 22
mineral constitution, 28
minerals found in (see Kaolin, Felspar, Quartz, Flint, Mica,
Iron, Calcite, Aragonite, Selenite, Dolomite, Salt, etc.).
Northamptonshire, 21
North-Eastern France, 20
Oxford clay, 33
Reading mottled clay, 19
of river terraces, 12
salt in, 25
sea-shore, 25
section of fluviatile brick-earths, 10
several kinds of fluviatile, discussed, 14, 15
Switzerland, 89
Thames Valley, 1, 2, 3, 4, 5
value of chemical analyses of, 28, 29
Brickmaking: earths suitable for (see Brick-earths)
Bricks, abrasion tests, 146
absorption of, 132
basic, 90
Bracknell, 135
colour of, 100
Dinas, 81
discolouration of, 114
durability of, 103
effect of conflagrations on, 117
efflorescence on, 110
London stock, 97
micro-structure of, 29, 118, 128
rubber, 29
specific gravity, 146, 149
Staffordshire blue, 99
Stourbridge, 82
strength of, 136
vegetable growth on, 113
weathering of, 105, 113
British Museum, fossils in, from brick-earths, 3, 26
Bronzite, 69
Brown brick-earths, 27
Burning bricks, 94
changes produced by, 98
temperature, 89

Calc spar, 49
Calcite, 39, 49
behaviour in kiln, 39
micro-structure of, 131
under blow-pipe, 74
Californian magnesite, 56
Carbon dioxide in quartz, 41
Carbonate of lime (see Calcite, Aragonite)
Chalk in brick-earths, 1
mixed with brick-earths, 53
pebbles in brick-earths, 50
Chateauroux, Oxford clay of, 24
Chemical affinity, 76
analyses of brick-earths, 28
analysis, 77
composition of air, 106
composition of brick-earths, Dinas, 52
composition, china clays, 78
composition of fire-clays, 80
composition of Kieselguhr, 92
composition of magnesian limestones, 90
composition, pottery clays, 82
composition of slates, 87
disintegration of rocks, 20
re-agents, 60, 63, 71
Chemistry of brick-earths, 58, 75
Chert, 41
Cheshire, salt in clays in, 25
China-clays, behaviour in the kiln, 36
chemical composition, 78
Cornwall, 35, 36, 37
Devon, 35
China-clay (see Kaolin and Felspar)
thickness of, 38
China-stone, decomposed, 37
Colour in the kiln, 98, 99
Colouring matter of bricks, 45
of bricks, 53
Colour of bricks (see Blue, Black, etc.).
Coprolites: impure varieties of phosphate of lime
found in brick-earths, 51
Cornish granite, 35
Cornwall, china-clays, 35, 36, 37
Cracks formed in bricks, 52
Crayford, brick-earth at, 1

Dartmoor granite, 55
Denudation, agents of, described, 6, 7
of sea-cliffs, 22
Devon, china-clays, 35
Diatomaceous earth, 42, 91
Dinas bricks, 52, 81
Discolouration of bricks, 114, 135
Dolomite in brick-earths, 55
micro-structure of, 131
under blow-pipe, 74
Drying bricks, 94
Durability of bricks, 103

Efflorescence on bricks, 110


Electric furnace, 33
Elephants’ remains, found in brick-earth, 2, 3
Erith, brick-earth at, 1
Estuarine brick-earths, 21
Expansion of bricks and variations of temperature, 115

Felspar, 34
chemical composition of, 34
micro-structure of, 129
under blow-pipe, 73
Ferruginous matter (see Iron)
Fire-bricks, Dinas, 52
earths suitable for making, 21
effect of lime in, 53
Kieselguhr for, 42, 91
strength of, 136
Fire-clays, chemical composition of, 80, 81
Newcastle-on-Tyne, 80
tests, 148
Welsh localities, 81
Fishes, fossil, 25
Flint, 39, 41
behaviour of in the kiln, 42, 43
implement: an implement, or tool, made of flint—in the sense
indicated in this work an implement made by pre-historic
man.
implements, found in brick-earths, 3, 5
micro-structure of, 129
origin of, 41
Fluid inclusions in quartz, 41
Fluorine in clays, 59
Fluviatile brick-earths: brick-earths that have been deposited in
rivers
Fossil shells, carbonate of lime in, 50
shells found in brick-earths, 4
sponges, in flint, 42
Fusion of brick-earths in the kiln, 29, 31

Gault clay, 51
Glaze, micro-structure of, 119, 120
Glazing, salt, 57
Granite, Cornish, 35
Dartmoor, 35
Granites, weathering of, 36
Greece, magnesite in, 56
Green bricks, 101
Grizzly bear’s remains found in brick-earth, 2
Gypsum in brick-earths, 54
under blow-pipe, 74

Heat, bricks affected by, 117


Hippopotamus remains found in brick-earth, 2

Ilford, brick-earth at, 1


Infusorial earth, Tuscany, 92
Iron, 44
a constituent of brick-earths, 44
behaviour in the kiln, 45
bricks, Saarbrücken, 92
micro-structure of, 130
mode of occurrence in brick-earths, 45
under blow-pipe, 73, 74
vapour in the kiln, 46
pyrites, 46, 131
pyrites, behaviour in the kiln, 48
pyrites, under blow-pipe, 74
pyrites, weathering of in bricks, 48

Jurassic estuarine clays, 21

Kangaroo rats, fossil, 25


Kaolin: a hydrous silicate of alumina, derived chiefly from the
decomposition of felspars
Kaolin, 31
behaviour in the kiln, 32, 33
chemical composition of, 78
micro-structure, 32, 33
under blow-pipe, 73
“Kaolinised” matter, 33
Kilns, temperature in, 98
Kieselguhr: a diatomaceous earth
Kieselguhr, 91
chemical composition of, 92
of the Isle of Skye, 42
Kimeridge clay brick-earth, 26

Labradorite felspar, chemical composition, 34


Lacustrine brick-earth: that laid down or deposited in lakes
brick-earths—Chapter II., 17–21
brick-earths, formation of, 17, 18
Lime, builder’s, 52
in bricks, 52
in manufacture of fire-bricks, 53
Limestone, a flux, 54
Limonite, under blow-pipe, 73
Lincolnshire brick-earths, 21
Loam: sandy clay
London stock bricks, 97, 140

Magnesian limestones, chemical composition of, 90


limestone (see Dolomite)
Magnesite, 55
behaviour in the kiln, 56
Californian, 56
in Greece, 56
Styrian, 56
under blow-pipe, 74
Malachite, 67
Malm bricks, 53, 86
Manganese, under blow-pipe, 74
Marcasite, 46, 47
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!

ebookfinal.com

You might also like