1. Practical jQuery 1st Edition Mukund Chaudhary
pdf download
https://ebookfinal.com/download/practical-jquery-1st-edition-
mukund-chaudhary/
Explore and download more ebooks or textbooks
at ebookfinal.com
2. We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.
Professional jQuery 1st Edition Cesar Otero
https://ebookfinal.com/download/professional-jquery-1st-edition-cesar-
otero/
Extending jQuery Keith Wood
https://ebookfinal.com/download/extending-jquery-keith-wood/
jQuery For Dummies 1st Edition Lynn Beighley
https://ebookfinal.com/download/jquery-for-dummies-1st-edition-lynn-
beighley/
Pro SharePoint with jQuery Phill Duffy
https://ebookfinal.com/download/pro-sharepoint-with-jquery-phill-
duffy/
3. Drupal 6 JavaScript and jQuery 1st Edition Matt Butcher
https://ebookfinal.com/download/drupal-6-javascript-and-jquery-1st-
edition-matt-butcher/
C Programming Step By Step Beginner s To Experts Edition
Harry. H. Chaudhary.
https://ebookfinal.com/download/c-programming-step-by-step-beginner-s-
to-experts-edition-harry-h-chaudhary/
jQuery Novice to Ninja Second Edition Earle Castledine
https://ebookfinal.com/download/jquery-novice-to-ninja-second-edition-
earle-castledine/
Wind and solar power systems design analysis and operation
2nd Edition Mukund R. Patel
https://ebookfinal.com/download/wind-and-solar-power-systems-design-
analysis-and-operation-2nd-edition-mukund-r-patel/
Beginning jQuery 2 for ASP NET Developers Using jQuery 2
with ASP NET Web Forms and ASP NET MVC 1st Edition Bipin
Joshi (Auth.)
https://ebookfinal.com/download/beginning-jquery-2-for-asp-net-
developers-using-jquery-2-with-asp-net-web-forms-and-asp-net-mvc-1st-
edition-bipin-joshi-auth/
9. 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/bulk-sales.
Any source code or other supplementary material referenced by the author in this text is available to readers at
www.apress.com. For detailed information about how to locate your book’s source code, go to
www.apress.com/source-code/.
10. We would like to dedicate this book to all those
who believe in honesty and hard work.
11. Contents at a Glance
About the Authors
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Evolution of jQuery
Chapter 2: Getting Started with jQuery
Chapter 3: Traversing DOM with jQuery
Chapter 4: DOM Manipulation with jQuery
Chapter 5: Events in jQuery
Chapter 6: Real World Events in jQuery
Chapter 7: Animation in jQuery
Chapter 8: Ajax with jQuery
Chapter 9: Creating Plug-ins with jQuery
Chapter 10: Integrating Plug-ins with jQuery
Chapter 11: Using jQuery Frameworks
Chapter 12: Testing jQuery with QUnit
Index
12. Contents
About the Authors
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Evolution of jQuery
Traditional JavaScript Basics
The Window Object
Child Objects
Old School Challenges
Challenges Pertaining to the Window Object
Challenges Pertaining to the Document Object
Challenges Related to the Globals
Need for a Revolution
Who Was the Revolutionary?
Why jQuery?
Minimal and Easy Coding
Readable/Clean Code
Easy CSS Handling
Animation Methods
Intuitive Function Calls
Summary
Chapter 2: Getting Started with jQuery
Document Object Model (DOM)
Downloading and Setting Up jQuery
Downloading from the Official Web Site
Including jQuery from a CDN
13. Clone from GitHub
jQuery Fundamentals
jQuery Syntax
Document Ready Event
jQuery noConflict() Method
jQuery Selectors
Working with jQuery
The Problem Statement
The Anonymous Function
Preloading Images with jQuery
each() in jQuery
Summary
Chapter 3: Traversing DOM with jQuery
Selecting Elements with CSS Selectors
Type Selector
Universal Selector
Attribute Selector
Class Selector
ID Selector
Pseudo Class Selector
Relationship-Based Selectors
Using jQuery Selectors
Type Selector
Universal Selector
Attribute Selector
Class Selector
ID Selector
Pseudo Class Selector
Other jQuery Selectors
Traversing DOM with jQuery Traversal Methods
The Curtain Raiser
jQuery Methods for DOM Traversal
Caching Selector and Chaining Methods
Selector Caching
Chaining
14. jQuery Filtering
The .eq() Method
The .filter() Method
The .first() Method
The .last() Method
The .has() Method
The .is() Method
The .not() Method
Summary
Chapter 4: DOM Manipulation with jQuery
Editing Appearance with jQuery CSS Methods
Obtaining CSS Properties
Setting CSS Properties
Setting Multiple CSS Properties
Editing/Changing an Element’s Attributes, Contents, and Position
Editing Attributes
Editing Contents
Creating and Inserting New DOM Elements
.append() vs. .appendTo()
Inserting New Elements in Specific Locations
Putting the Methods to Work
Removing and Cloning DOM Elements
Working with Dimensions
jQuery width() and height() Methods
jQuery innerWidth() and innerHeight() Methods
jQuery .outerWidth() and .outerHeight() Methods
Summary
Chapter 5: Events in jQuery
Introducing Events
Browsers and Events
Event Listeners and Event Handlers
The Event() Method in jQuery
15. Binding Events
Unbinding Events
Events Propagation and Events Bubbling
The Event Capturing and Event Bubbling Models
The W3C Event Model
Callback Action in Event
Summary
Chapter 6: Real World Events in jQuery
Common Gotchas in Event Handling
Handling Dynamic Elements
Handling jQuery Animation Buildup
Preventing Event Propagation and Bubbling
Handling the Event Queue
How Handling Works in a jQuery Event Queue
The jQuery queue() Method
Building a jQuery UI Accordion
Using the jQuery UI Accordion
Customizing an Accordion
Validating Form Elements
Using the Validate Plug-in
Validating Form Elements Using Customized jQuery
Summary
Chapter 7: Animation in jQuery
Life Without jQuery
jQuery’s animate()
Fading in jQuery
Using the fadeOut() Method
Using the fadeIn() Method
Using the fadeTo() Method
Using the fadeToggle() Method
Sliding in jQuery
16. Using the slideUp() Method
Using the slideDown() Method
Using the slideToggle() Method
Toggle() in jQuery
Creating a Basic Light Box
Controlling Animation Behavior
Smoothing Your Animations
Using the fx Object to Control Frame Rate
Turning Off Your Animation
Creating a Basic Image Slider
Summary
Chapter 8: Ajax with jQuery
Introducing Ajax
How Did Ajax Originate?
The Technologies That Make Up Ajax
Ajax Using jQuery
The Nuts and Bolts of Ajax in JavaScript
The jQuery Approach
Introducing JSON
Understanding JSON
Parsing JSON with JavaScript
Using the jQuery Alternative to JavaScript
Ajax and JSON Usage Example
Summary
Chapter 9: Creating Plug-ins with jQuery
What Is a Plug-in?
Plug-in Best Practices
Private Variables
Public Variables
Parameters
Plug-in Writing Guidelines
17. Do You Really Need the Plug-in?
Reuse What Already Exists
Preserve the Reference to jQuery
Do Not Unnecessarily Modify Objects
Ensure Chainability
Creating a Form Validation Plug-in
Creating an Accordion Plug-in
Summary
Chapter 10: Integrating Plug-ins with jQuery
Plug-in Repositories
The jQuery Registry
The NPM Open Source Package Repository
The GitHub Repository
Integrating Plug-ins
Downloading and Saving
Do a Test Run on Some Simple Elements
Include the Plug-in File in the script Tag
The Dilemma—in the Head or at the End of the Body
Keep the Code Clean
Plug-in Customization
Minifying Code for Distribution
Compression vs. Minification
What Does Minified Code Look Like?
There Is More: Uglification and Beautification
Summary
Chapter 11: Using jQuery Frameworks
JavaScript and jQuery Frameworks
Bootstrap
AngularJS
Components in jQuery
jQuery UI
Drag and Drop Using jQuery UI
18. Autocomplete
Datepicker
jQuery Mobile
Some Cool Features of jQuery Mobile
Ajax Navigation System
Pop-ups in jQuery Mobile
Summary
Chapter 12: Testing jQuery with QUnit
QUnit as a JavaScript Framework
Introduction to Unit Testing
The Need for Unit Testing
Why QUnit?
Getting Started with QUnit
QUnit Syntax
Styling the Test Result
Writing the First Test Case
Commonly Used QUnit Methods
Testing DOM Manipulation
Refactoring Code
A Simple Refactoring
Moving Ahead in Refactoring
Writing Another Test Case on the Refactored Code
Summary
Index
19. About the Authors
Mukund Chaudhary is enamored of technology and keeps himself up-to-date through
avid reading. In his leisure time, he can be found reading articles on current affairs and
technologies alike. A perfectionist, he is a product manager by profession and is quite
strict when it comes to delivery deadlines. He feels that 24 hours in a day are sufficient,
provided a person has plans that are correct and clear.
Ankur Kumar is a software engineer by profession and an adventurer by nature. He is a
person who reads people’s faces by instinct. He believes that being honest and true to
oneself works wonders. He also believes that knowledge is relative in this world, and
20. that it is no big deal to accept that learning never stops as long as a person is alive.
Ankur has worked on open source web technologies for a major part of his professional
career. He offers thanks to the Almighty “for making us what we are and showing us the
way ahead!”
21. About the Technical Reviewer
Jose Dieguez Castro is a senior system administrator, working currently as a freelance
consultant, who has worked in a wide range of projects—from small to large
infrastructures, in the private and public sectors. When asked about his specialty, he
answers: “Get the job done.” He also likes to think of himself as a developer, who
cares too much about software libre. Photography, sports, music, and reading are his
preferred ways of freeing his mind from work. He can be reached at
jose@jdcastro.eu.
22. Acknowledgments
I take this opportunity to express my gratitude to everyone who supported me at all
times. I am thankful to the editors for their aspiring guidance, invaluably constructive
criticism, and friendly advice.
I sincerely thank everyone, including my parents, my better half, friends, and
teammates, who gave their suggestions for improving this book. Special thanks to my
grandfather, the late Kameshwar Chaudhary, who always inspired me to write.
—Mukund Chaudhary
I take this opportunity to thank the Almighty, as well as the extremely careful support
staff at Apress, which was there at all times to guide us in the right direction. I
particularly acknowledge the editors, who took great pains to understand my intent, and
the way they managed the activities pertaining to giving this book its current form.
Although thousands of miles away, I always received abundant assistance from them.
I also received enormous support from my parents all the while I was writing.
Special thanks to my wife, Neha, who was patient enough to let me focus on providing
quality content for this book.
—Ankur Kumar
23. Introduction
This book aims to provide information to developers who have worked on JavaScript
and wish to gain hands-on experience with jQuery. It starts by reviewing some
JavaScript concepts and forges ahead to establish the need for a standard framework.
This need is addressed by this book, which explores jQuery as a JavaScript framework
and covers further developments, with the aim of helping readers to become familiar
with the way problems are solved using jQuery.
Practical demonstrations are offered throughout the book, and the same examples are
used across multiple demonstrations to ensure that readers receive a multidimensional
view of the subject matter. The book concludes by providing information on how to test
applications written in jQuery or JavaScript.
24. CHAPTER 1
Evolution of jQuery
The first and foremost question that web developers about to start working on jQuery
face is, Are JavaScript and jQuery related, or are they two completely different entities
altogether? Although we could simply reply, yes, they are related, and move on, we will
attempt in this chapter to introduce jQuery and its evolution from JavaScript. By the end
of this chapter, we hope to have explained the following:
How JavaScript is used to solve common web development
problems
The most common challenges that web developers face
Changing times and, hence, technology
The mastermind behind jQuery
Why jQuery is an important component of web development
Traditional JavaScript Basics
The evolution of web technology saw a transition from Web 1.0 to Web 2.0. The impact
of this change was expected to alter the way web-based applications—essentially web
sites—would replace desktop-based applications, both in terms of the functionality they
provided, as well as their look and feel. By this time, and due to this objective in their
development plans, web developers were strongly feeling the need to add dynamic
behavior to their static web pages. JavaScript was the only savior, according to the old
school of web development. For each and every dynamic behavior to be performed on a
web page, JavaScript code had to be written. The job of the web developer was
facilitated by JavaScript, because the code worked fine.
A JavaScript developer now had the freedom to use some default objects that
25. became available. These objects made possible some methods and operations that
improved the dynamic behavior of web pages. In most cases, the code would roam
about using the basic program constructs of JavaScript. A walk through some of the
objects and associated methods and properties (or attributes) available by default with
JavaScript will help you understand the basic functionality that the library could
provide. This will make you understand how JavaScript contributed to solving common
web development problems (and helps even today). The most basic validations were
easily achieved by these components provided by JavaScript.
The Window Object
There is a mother object—window—that contains everything in it a developer might
need. A window object represents an open window in a browser and provides a
number of methods pertaining to an open window. This object, just like a normal class
object, encapsulates a number of member functions or methods, properties, and a
number of child objects as well. The child objects, which we discuss in the next
section, in turn encapsulate some other functionality and ensure keeping JavaScript code
readable and maintainable (as in the case of all other languages following the object-
oriented programming [OOP] philosophy or paradigm). Before turning to the child
objects, however, let’s consider some common window object methods and attributes.
Methods
Some extremely common methods, accompanied by a brief description, in addition to
the common problems they solve, are stated in the succeeding text.
alert(): The common problem that this alert method is used to
solve is to display some message upon some validation error,
let’s say, or some happening of interest to the end user currently
viewing the web page you have created. You could pass on some
string—simple or composite—to the alert method, and the
method would treat all such valid strings alike.
setTimeout(): This method is used to delay the start of some
method. Using the setTimeout method, you could add some delay
to the response that was to be conveyed to the end user viewing
your web page. This is particularly useful in those cases in which
you know beforehand the expected time that a certain method
will take to execute, so you could queue the next method after a
27. At this era there was no country—that is to say, the country had no
resemblance to what it is at present; it was cultivated—that was
necessary; but it was not inhabited. The rural proprietors were the
inhabitants of the cities; they went out to look after their farms,
and they often kept a certain number of slaves upon them; but
what we at present call the country, consisting of a scattered
population, in isolated abodes, or in villages, strewed over the
whole soil, was a thing altogether unknown to ancient Italy.
When Rome extended, what were her proceedings? Peruse her
history, and you will see that she conquered or founded towns; it
was against towns she fought, or with towns she made treaties,
and also into towns she sent colonies. The history of the conquest
of the world by Rome, is the history of the conquest and founding
of a great number of cities. In the East, the extension of the
Roman sway does not quite bear this character; the population was
there distributed differently from the western: being under another
social system, it was much less concentrated in towns. But as it is
only with the European population that we are interested, what was
passing in the East is of little importance.
Confining ourselves to the West, we everywhere discern the fact
that I have pointed out. In Gaul, in Spain, we meet with nothing
but towns; at a distance from them, the territory is covered with
marshes and forests. Examine the character of the Roman
monuments, of the Roman roads. We find great roads leading from
one town to another; that multitude of small roads which now
intersect the country in every direction had no existence. There was
nothing resembling that countless throng of small monuments,
villages, country-houses, churches, dispersed over the land since
the middle ages. Rome has transmitted to us only colossal
monuments impressed with the municipal character, suited for a
numerous population collected at one point. Under whatever aspect
the Roman world may be considered, this almost exclusive
preponderance of cities, and the consequent non-existence of a
country, socially speaking, will be found. This municipal character in
28. the Roman world evidently rendered the unity and social bond of a
great state extremely difficult to establish and maintain. A
municipality like Rome had been able to conquer the world, but it
was not so easy a task to govern and organise it. Thus, when the
work seemed consummated, when all the West, and a great part of
the East, had fallen under the Roman sway, we find this prodigious
accumulation of cities, of small states instituted for isolation and
independence, disunited, detached from each other, and slipping
the noose, as it were, in all directions. This was one of the causes
which led to the necessity of an empire of a more concentrated
form of government, and one more capable of holding elements so
slightly coherent in a state of union. The empire endeavoured to
introduce unity and connection into this scattered society. It
succeeded to a certain extent. Between the reigns of Augustus and
Diocletian, a civil legislation was developed, coincidental with that
vast system of administrative despotism which spread over the
Roman world a network of functionaries upon a hierarchical form of
distribution, closely linked amongst themselves, and to the imperial
court, and solely employed in giving effect to the decrees of power
in society, and in rendering available to power the tributes and
capabilities of society.
Not only did this system succeed in rallying and compressing
together the elements of the Roman world, but the idea of a
despotism, of a central power, penetrated the minds of men with a
singular facility. We are astonished at beholding in this ill-united
collection of small republics, in this association of municipalities, a
reverence for the imperial majesty, sole, august, and sacred, prevail
with such rapidity. The necessity of establishing some common
bond between all these portions of the Roman world must have
been extremely urgent when the modes and almost the sentiments
of despotism found so ready an acceptation in the minds of men.
The Roman Empire was sustained against the dissolution which was
threatened from within, and against the barbaric invasions from
without, by these principles, by its administrative organisation, and
29. by the system of military organisation which was joined to it. It
strove for a long time in a continual state of decay, but always
defending itself. The moment at last arrived when the struggle
ceased; neither the skill and sagacity of despotism, nor the stolid
imperturbability of subjection, any longer sufficed to hold up this
great body. In the fourth century it was rented and dismembered
on all sides; the barbarians poured in at all points; the provinces no
longer made any resistance, or concerned themselves with the
general destiny. It was then that a singular idea came into the
heads of certain emperors; they wished to make an experiment
whether hopes of general freedom, a confederation or system
analogous to what we at the present day call the representative
form of government, would not better defend the unity of the
Roman Empire than the despotic administration. Here is a rescript
of Honorius and Theodosius the younger, addressed in the year 418
to the Prefect of Gaul, the sole object of which was to endeavour
to establish a sort of representative government in the south of
Gaul, and by its assistance to still maintain the integrity of the
Empire:—
'Rescript of the Emperors Honorius and Theodosius the younger,
addressed in the year 418 to the Prefect of the Gauls sitting in
the town of Arles.
'Honorius and Theodosius, Augusti, to Agricola, Prefect of the
Gauls.
'In consequence of the very satisfactory exposition that your
Magnificence has made to us, among other information greatly
to the advantage of the republic, we decree, with the purpose
of giving them the force of law in perpetuity, the following
dispositions, to which the inhabitants of our seven provinces
[Footnote 4] will pay due obedience, they being such as they
themselves might have wished and demanded.
30. [Footnote 4: The Viennoise, the first Aquitaine, the
second Aquitaine, the Novempopulanie, the first
Narbonnaise, the second Narbonnaise, and the province
of the Maritime Alps.]
Inasmuch as persons in office, or special deputies, frequently resort
to your Magnificence on affairs either of public or private utility, not
only from each of the provinces, but also from every town, either
to render accounts, or to treat of matters having reference to the
interest of the proprietors, we have considered that it might be
turned to good account and great advantage if, at a certain epoch
in every year, dating from the present, there should be an assembly
of the inhabitants of the seven provinces held in the chief city—that
is to say, in the town of Arles. By such an institution, we have
equally in view the providing for individual as well as general
interests. In the first place, by the most notable inhabitants
meeting together in presence of the prefect, if the public order
should not induce his absence, the best possible information will be
obtained upon every subject under deliberation. Nothing that is
discussed and decided, after mature deliberation, will remain
unknown to any of the provinces, and those persons who have
taken no part in the assembly will be equally bound to follow the
same rules of justice and equity. Furthermore, by ordaining that an
assembly be held every year in the city of Constantine, [Footnote
5] we believe we shall promote not only the public good, but also
social relations. The city is so advantageously situated, strangers
frequent it in such numbers, and it enjoys so extended a
commerce, that everything that grows, or is manufactured
elsewhere, is brought thither.
[Footnote 5: Constantine the Great had a singular
affection for the city of Arles. It was he who established
in it the seat of the Gaulish prefecture. He also wished
that it should bear his name, but usage was more
powerful than his inclination.]
31. All the famous productions of the rich East, spicy Arabia, mild
Assyria, fertile Africa, beauteous Spain, and valorous Gaul,
abound in that place with such profusion, that all things
admired for their magnificence in the various parts of the world
seem the products of its soil. Besides, the junction of the Rhone
with the Tuscan Sea draws near, and renders almost neighbours,
the countries which the first traverses, and which the second
bathes with its sinuosities. Thus, since the whole earth places at
the disposal of this city all its most estimable possessions, since
the individual productions of all countries are there transported
by land, by sea, by the course of rivers, by means of sails, oars,
and wagons, will not our Gaul perceive the benefit of the order
that we give to convoke a public assembly in that city, where all
the enjoyments of life, and all the facilities for commerce, are
found concentrated by, as it were, the especial gift of God?
'The illustrious prefect, Petronius [Footnote 6] with a
praiseworthy and most reasonable purpose, issued orders at a
previous date that this custom should be observed; but as its
fulfilment was interrupted by the confusion of the times, and
the reign of usurpers, we have resolved to restore it to vigour
by our authoritative prudence. Therefore, your Magnificence
Agricola, our dear and well-beloved cousin, conforming yourself
to our present ordinance, and the custom established by your
predecessors, will cause the following dispositions to be
observed in the provinces:
[Footnote 6: Petronius was prefect of the Gauls between
the years 402 and 408.]
'Let intimation be given to all persons honoured with public
functions, or proprietors of domains, and all the judges of the
provinces, that they must assemble in council every year in the
city of Arles, in the interval elapsing between the ides of August
and those of September, the actual days of meeting and of
sitting being fixed at pleasure.
32. 'Novempopulanie and the second Aquitaine, as the most distant
provinces, may, if their judges are retained by indispensable
duties, send deputies in their place, according to custom.
'Those who shall fail to appear at the prescribed place and time
shall pay a fine, rated to the judges at five pounds of gold, and
to the members of the curiæ [Footnote 7] and the other
dignitaries, three pounds of gold.
[Footnote 7: The municipal bodies of the Roman towns
were called curiæ, and the members of those bodies,
who were very numerous, curiales.]
'We design by this measure to confer great advantages and an
important boon on the inhabitants of our provinces. We are
likewise assured of adding to the embellishment of the city of
Arles, to the fidelity of which we owe much, according to our
brother and patrician. [Footnote 8]
[Footnote 8: Constantine, the second husband of
Placidea, whom Honorius had taken for a colleague in
421.]
'Given on the 15th of the calends of May, and received at Arles
the 10th of the calends of June.'
The provinces and towns refused the boon; no deputies were
named, no one would go to Arles. Centralisation and unity were
contrary to the primitive nature of that society; the spirit of locality,
of municipality, was displayed in full force, and the impossibility of
reconstituting a general society or country was clearly evidenced.
The towns shut themselves up within their walls, and looked not
beyond their own affairs; and the Empire fell because no one would
be of the Empire, because the citizens would no longer concern
themselves with anything but their own city. Thus, at the fall of the
33. Roman Empire, we find again the same fact that was observable at
its commencement—the predominance of the municipal form and
spirit. The Roman world returned to its first condition: towns had
formed it; it was dissolved, but the towns remained.
It is the municipal system that the ancient Roman civilisation
bequeathed to modern Europe; in a very irregular and weakened
form, and doubtless very inferior to what it had been in the early
times, but still the only real constituted system which had alone
survived all the elements of the Roman world.
When I say alone, I am wrong. Another fact, another idea, equally
survived—namely, the idea of the Empire, the name of the emperor,
the maxim of imperial majesty, and of an absolute, sacred power,
attached to that name. These are the elements that Roman
civilisation transmitted to the European civilisation; on one hand,
the municipal system, its customs, rules, and precedents,
containing the germ of liberty; on the other, a uniform and
universal civil legislation, coupled with the idea of the absolute
power and the sacred majesty of the imperial name, containing the
principle of order and subjection.
Influence Of The Church.
But at the same time a very different society, founded upon totally
distinct principles, animated by other sentiments, and one destined
to infuse into the modern European civilisation elements of quite a
different nature, had arisen in the bosom of the Roman society—
namely, the Christian church. I speak peculiarly of the Christian
church, and not of Christianity. At the end of the fourth, and
commencement of the fifth century, Christianity had ceased to be
simply an individual creed; it had become an institution, and had
taken a constituted form; it had its own government, a body of
clergy, a hierarchy arranged for the different clerical functions,
revenues, means for independent action, and rallying-points
34. suitable to a great society, provincial, national, and oecumenical
councils, and the custom of deliberating in common upon the
affairs of the society. In a word, Christianity at this epoch was not
merely a religion, it was a church.
If it had not been a church, it is impossible to say what might have
happened to it amid the fall of the Roman Empire. I confine myself
to purely human considerations; I put aside every element foreign
to the natural consequences deducible from natural facts; and I
believe that if Christianity had been, as in the early times, only an
individual belief, sentiment, or conviction, it would have sunk under
the ruins of the Empire, and the invasions of the barbarians. It
succumbed at a later date in Asia and in the north of Africa, under
an invasion of the same nature, an invasion of Moslem barbarians,
even when it was in a state of institution, when it was an
established church. Much more might the same result have
occurred at the fall of the Roman Empire. There were at that time
none of the means in existence by which at the present day moral
influences are established or offer resistance independently of
institutions, none of the means by which a mere truth or idea
acquires an empire over the minds of men, governs actions, and
determines events. Nothing existed in the fourth century to give to
personal ideas and sentiments such a sway. It is clear that a
society powerfully organised and vigorously governed was needed
to struggle against so destructive a crisis, and to arise victorious
from so fearful a conflict. It is not therefore too much to affirm
that, at the end of the fourth, and beginning of the fifth century, it
was the Christian church which saved Christianity; it was the
church, with its institutions, its magistrates, its temporal power,
which strove triumphantly against the internal dissolution which
convulsed the Empire, and against barbarity which subdued the
barbarians themselves, and became the link, the medium, the
principle of civilisation, as between the Roman and barbarian
worlds. Hence it is the state of the church rather than of
Christianity, properly so called, in the fifth century, which ought to
be investigated, in order to discover in what Christianity has from
35. that period aided modern civilisation, and what elements it has
introduced. An inquiry necessarily arises, What was the Christian
church at that epoch?
When we consider, under a merely human aspect, the different
revolutions which have been accomplished in the development of
Christianity, from its origin to the fifth century, taking it only as a
society, and not as a religious creed, we find that it has passed
through three stages essentially distinct.
In the earliest period, the Christian society presents itself as a
simple association arising from a common creed, from common
sentiments; the first Christians congregated in order to enjoy
amongst themselves an interchange of the religious emotions and
convictions common to all their breasts. There was no settled
system of doctrines, of rules, or of discipline, or no body of persons
invested with authority.
There is no doubt that in every society that exists, however newly-
born or feebly-constituted it may be, a moral power is perceptible,
animating and directing it. So in the different Christian
congregations there were men who preached, taught, and morally
governed the rest, but no superior, or no discipline, was regularly
instituted; the primitive state of the Christian society was simply an
association of persons drawn together by an identity of creed and
sentiment.
In proportion as it progressed (and very speedily, for the marks are
traceable in the earliest records), a system of doctrines, of rules, of
discipline, and of functionaries or magistrates, was brought out. Of
the magistrates some were called presbuteroi, or ancients, who
became the priests; others episkopoi, or inspectors, or watchers,
who became bishops; and others diakonoi, or deacons, charged
with the care of the poor and the distribution of alms.
36. It is almost impossible to determine the precise functions of these
different magistrates; the line of demarcation was probably very
vague and fluctuating, but at all events the institutions had a
commencement. This second epoch, however, had a predominant
feature, which consisted in the control, the preponderance
belonging to the body of the faithful. It was they who decided both
as to the choice of dignitaries or magistrates, and as to the
adoption as well of systems of discipline as of doctrine. The
Christian people were not as yet separated from the government of
the church. They did not exist apart from or independently of each
other, and the Christian people continued to exercise the principal
influence in the society.
In the third era everything was changed. A clergy was formed
distinct from the people, a body of priests having riches,
jurisdiction, a constitution of their own, in a word, a complete
government, being in itself a regular society, furnished with all the
means of existence independently of the society for whose behoof
it was intended, and over which it extended its influence. This was
the state in which the Christian church appeared at the
commencement of the fifth century, and in the third stage of its
constitution. The government was not completely taken out of the
hands of the people, or separated from them; a system prevailed
which is without any parallel, especially in religious affairs; but in
the relations between the clergy and the flocks of the faithful, the
clergy ruled almost without control.
The Christian clergy had, besides, another means of influence of a
different character. The bishops and clerks became the chief
municipal magistrates. We have seen that the municipal system
was, properly speaking, all that remained of the Roman Empire.
From the annoyances of despotism, and the ruin of the towns, it
came to pass that the curiales, or members of the municipal
bodies, fell into despair and apathy. The bishops and the body of
priests, on the contrary, being full of life and zeal, naturally offered
themselves to guard and direct affairs. It would be wrong to
37. reproach them with officiousness, or to tax them with usurpation;
they merely obeyed the natural impulse of events. The clergy alone
were morally strong and animated, and it became powerful; the
result is a law of the universe.
All the legislation of the emperors at that epoch bears marks of this
revolution. In the codes both of Theodosius and Justinian we find a
great number of regulations which remit municipal affairs to the
clergy and the bishops. I will quote some of them.
'Cod. Just. 1. i. tit. iv. de episcopali audientia, § 26.—With
regard to the annual affairs of the cities (whether they refer to
the ordinary city revenues, resulting either from funds arising
from the city property, or from individual gifts or legacies, or
from any other source, whether deliberation is required touching
the public works, or magazines of provisions, or aqueducts, or
the maintenance of baths or of harbours, or the construction of
walls or towers, or the repairing of bridges and roads, or
lawsuits in which the city may be engaged, on account of public
or private interests), we ordain as follows:—The very pious
bishop, and three men of good fame amongst the chief men of
the city, shall assemble together; they shall examine every year
the works that have been performed, and they shall take care
that those who conduct them, or have conducted them, do
measure them with precision, give in accounts of them, and
make it clear that they have fulfilled their engagements in the
administration, whether it be of the public monuments, or of the
sums appropriated to provisions and baths, or of what is
expended for the repair of roads, aqueducts, or any other work.
'Ibid. § 30.—With regard to the guardianship of young people,
of the first or second age, and of all those to whom the law
assigns curators, if their fortune does not exceed 500 aurei, we
ordain that the nomination of the president of the province shall
not be waited for, as it might give rise to heavy charges,
especially if the said president did not reside in the city where
38. the guardianship is required to be provided. The nomination of
the curators or tutors shall therefore be made by the magistrate
of the city, in concert with the most pious bishop, and other
persons invested with public functions, if the city possess
several.
'Ibid. 1. i. tit. lv. de defensoribus, § 8.—We will that the
defenders of the cities, being well instructed in the holy
mysteries of the orthodox faith, be chosen and instituted by the
venerable bishops, the clerks, the notables, the proprietors, and
the curiales. As to their installation, it shall be referred to the
glorious power of the Prefect of the Pretorium, in order that
their authority may gather more solidity and vigour from the
admissory letters of his Magnificence.'
I might cite a great number of other laws illustrative of the fact
everywhere displayed, that between the Roman municipal system
and the municipal system of the middle ages an ecclesiastical
municipal system interposed; that the preponderance of the clergy
in city affairs succeeded that of the old municipal magistrates, and
preceded the organisation of the modern corporations.
Thus, by its own constitution, by its action on the Christian
population, and also by the part it bore in civil affairs, the Christian
church exercised prodigious means of influence. From that epoch,
therefore, it operated powerfully on the character and development
of modern civilisation. I will endeavour to sum up the elements it
has infused into it.
In the first place, an incalculable benefit resulted from the
existence of a moral influence and force, of a force which simply
rested on moral convictions, persuasions, and opinions, in the midst
of that deluge of physical force which poured upon society at that
epoch. If the Christian church had not been established, the whole
world had been overborne by pure physical force. It alone exercised
a moral power. It did more: it sustained and spread the idea of a
39. rule or law which was superior to all human laws; it maintained, for
the safety of humanity, that fundamental doctrine that there is
above all human laws a law, which, according to the spirit of times
and manners, is sometimes called reason, and sometimes Divine
will, but which, at all periods, and in all places, is the same law
under different designations.
The church, then, originated a great fact—namely, the separation of
the spiritual from the temporal power. This separation is the source
of liberty of conscience; and it rests upon no other principle than
that which serves as the base of the most unrestricted and
extended liberty of conscience. The separation between the
temporal and spiritual powers is founded upon the principle that
physical force has no right or influence over the minds of men, or
over conviction and truth. It results from the distinction established
between the world of thought and that of action, between
circumstances of an internal and those of an external nature. So
that this maxim of liberty of conscience—for which Europe has
struggled and suffered so much, and which has prevailed only so
lately, often against the exertions of the clergy—was laid down
under the name of a separation between temporal and spiritual
power in the earliest stages of European civilisation; and its
introduction and maintenance was owing to the Christian church
being compelled, by the necessity of its situation, to defend itself
against the barbarism of the times.
The Christian church, therefore, shed upon the European world in
the fifth century three essential blessings—the recognition of a
moral influence, the upholding a divine law, and the disjunction of
temporal and spiritual power.
But even at that period all its influence was not equally salutary. So
early as the fifth century, some evil principles made their
appearance in the church, which have played an important part in
the development of our civilisation. Thus there arose within it at
that era the doctrine of the separation of the governing and the
40. governed, the attempt to establish the irresponsibility of rulers to
subjects, to impose laws, to control opinion, and to dispose of men,
without the consent of the governed, or regard being paid to their
reason and inclination. It likewise strove to infuse into society the
theocratic principle, to seize upon temporal power, and to exercise
exclusive domination. And when it failed in fully accomplishing this
design, it allied itself with temporal princes, and supported their
absolute power at the expense of the liberty of the people, in order
that it might obtain a share for itself.
Such were the principal elements of civilisation that Europe drew
from the church and the Empire in the fifth century. It was in this
state that the barbarians found the Roman world when they came
to take possession of it. In order to comprehend all the elements
which were included and mingled in the cradle of our civilisation,
there remains nothing but the barbarians to contemplate.
It is not with the history of the barbarians that we have to concern
ourselves, for relation is not our province. We are aware that, at
the epoch in question, the conquerors of the Empire were almost
all of the same race, all Germans, except some Slavonic tribes, as
the Alani, for example. We are likewise aware that they were all
pretty nearly in the same state of civilisation. Some difference
might exist amongst them, according to the greater or less degree
of contact into which they had respectively come with the Roman
provincials. Thus there is no doubt that the Goths were more
advanced and milder in their manners than the Franks. But
considering things in a general point of view, and with reference to
their results upon ourselves, this early diversity amongst the
barbaric tribes in civilisation is of no importance.
It is the general state of society amongst the barbarians that it
behoves us to ascertain; and this is a subject which is involved in
considerable difficulty. We can understand with comparative ease
the Roman municipal system and the Christian church, because
their influence is perpetuated even to our own days, and we
41. discover traces of them in a multitude of actual institutions and
circumstances, affording us a thousand means of identifying and
explaining them. But the manners and the social state of the
barbarians have completely perished; we are reduced to the
necessity of evoking them either from the most ancient historical
monuments, or by an effort of the imagination.
There is a sentiment, a fact, which we must impress upon our
minds, in order to have a true idea of what a barbarian was, and
that is the feeling of individual independence, the joy he
experienced in casting himself, in the fulness of his strength and
freedom, into the midst of worldly vicissitudes—the pleasure to him
of activity without labour, the charm of an adventurous career, full
of uncertainty, inequality of fortune, and danger. This was the
predominant sentiment of the barbarian state, the moral craving
which urged these human masses to movement. At present, in a
society so regular as that into which we are wedged, it is difficult
to imagine the extent of dominion which this sentiment exercised
over the barbarians of the fourth and fifth centuries. There is only
one work which in my opinion presents this character of barbarism
in its full strength—namely, 'The History of the Conquest of England
by the Normans,' by M. Thierry; it is the only book in which the
motives, the longings, and the impulses, which are the springs of
actions in men when in a social state bordering upon the barbaric,
are perceived and brought out with true Homeric vividness.
Nowhere do we perceive so well what a barbarian is, or in what his
life consists. Something also of the same is found, though,
according to my ideas, in a far inferior degree, and in a much less
simple and truthful manner, in Mr. Cooper's romances of the North
American savages. The existence of the American savages, the ties
and the sentiments which they bear with them in the midst of the
woods, recall to a certain extent the manners of the ancient
Germans. Of course these pictures are somewhat idealised and
poetical, the dark side of barbaric life and manners being studiously
glossed over. I speak not only of the ills provoked by these
manners in the social state, but also of the inward and individual
42. state of the barbarian himself. In this furious craving for personal
independence there was far more grossness and animalism than we
would conclude from the work of M. Thierry; there was a degree of
brutality, frenzy, and sullen apathy, which is not always faithfully
given in his account. Nevertheless, when we regard things
fundamentally, we are convinced that, in spite of this alliance of
brutality, materialism, and boorish selfishness, the desire for
individual independence is a noble moral sentiment, which derives
its strength from the moral nature of man; it consists in the
gratification of feeling as a man, in the consciousness of personality
and of human free-will in its fullest development.
The German barbarians introduced this feeling into the European
civilisation; it was unknown to the Roman world, to the Christian
church, and to almost all the ancient civilisations. Liberty in those
ancient civilisations meant political, municipal liberty. Men were not
engaged in a strife for personal liberty, but for their liberty as
citizens; they belonged to an association, to it they were devotedly
attached, and for it they were prepared to sacrifice themselves. It
was the same in the Christian church: there prevailed within it a
sentiment of strong regard for the Christian corporation, of devotion
to its laws, and an ardent desire to extend its empire; or rather the
religious sentiment caused a reaction in the minds of men, which
was displayed in an inward struggle to subdue individual liberty,
and to give blind submission to what faith decreed. But the feeling
of personal independence, the taste for liberty making itself
apparent at all moments without other design sometimes than that
of proving itself—this was a sentiment unknown to the Roman
society and to the Christian church. It was imported and fixed by
the barbarians at the birth of modern civilisation, and it has
performed too important a part, and produced too many happy
results in connection with it, to be omitted as one of its
fundamental elements.
There is a second fact, a second element in civilisation, that we
likewise draw exclusively from the barbarians. It is the military
43. chieftainship, the tie that was formed between individuals as
warriors, and which, without destroying the liberty of each, without
destroying, except to a certain extent, the equality which almost
completely existed amongst them, introduced a graduated
subordination, and gave a beginning to that aristocratic
organisation which at a later date expanded into the feudal system.
The groundwork of this relation was the attachment of man to
man, the fidelity of one individual to another, without any outward
compulsion, and without any obligation founded on the general
principles of society. In the ancient republics, no man was of his
own accord specially attached to any other man; all were bound to
their city. With the barbarians the social bond was formed amongst
individuals, in the first place by the relation of the chief to his
companion, when they lived in a banded state traversing the face
of Europe, and later by the relation of suzerain and vassal. This
second principle, which has also had an important effect on modern
civilisation, this devotedness of man to man, comes to us from the
barbarians, and from their manners it has passed into ours.
Was I wrong, then, in stating at the commencement that modern
civilisation was at its very origin as varied, agitated, and confused
as I endeavoured to represent it in the general picture which I gave
of it? Do we not discover at the dissolution of the Roman Empire
almost all the elements which meet in the progressive development
of our civilisation? Three perfectly different societies are found at
that period; the municipal society, the last remnant of the Roman
Empire, the Christian, and the barbarian society. We find these
societies very differently organised, based upon perfectly distinct
principles, and inspiring men with opposite sentiments: we perceive
the longing for the most absolute independence by the side of the
most complete subservience; military chieftainship ranged with
ecclesiastical domination; the spiritual and temporal powers in
activity on every side; the canons of the church, the studied
legislation of the Romans, and the almost unwritten customs of the
barbarians—everywhere a mixture, or rather a co-existence, of
races, tongues, social situations, manners, ideas, and feelings, all
44. the most contrary to each other. This I adduce as a satisfactory
proof of the accuracy of the general character under which I have
laboured to present our civilisation.
45. This confusion, diversity, and strife, have doubtless cost us dear;
they have retarded the progress of Europe; to them are owing the
storms and agonies to which she has been a prey. Yet I am not of
opinion that we should regret them. To nations, as well as to
individuals, the opportunity of the most varied and complete
development, of pushing onwards in all directions, and to an almost
indefinite extent, compensates by itself alone for all the sacrifices it
may have cost to obtain the faculty of enjoying it. Upon a
comprehensive view, this agitation, violence, and laboriousness,
have availed more than the simplicity with which other civilisations
are marked, and the human race has thereby gained more than it
has suffered.
We have now traced in its general features the state in which the
fall of the Roman Empire left the world, and the different elements
which were in turmoil and commixture, germinating European
civilisation. Henceforth we shall see them advancing and acting. In
the next lecture I shall endeavour to show what they became, and
what they effected, in the epoch that we are accustomed to call
the times of barbarism—that is to say, the period during which the
chaos of the invasion lasted.
Lecture III.
First Ages Of Civilisation.
I have brought forward the fundamental elements of European
civilisation by tracing them in its very cradle, at the moment that
the Roman Empire fell. I have endeavoured to point out how great
was their diversity, how constant their strife, and that none of them
succeeded in gaining a mastery over our society, or at least in
ruling it so effectually as to subject or expel the others. We have
seen that in this consists the distinctive character of the European
civilisation. We now come to its history, at its first start, in the ages
46. that it is usual to designate 'the barbarous.' At the first glance that
we cast upon this epoch, it is impossible not to be struck with a
fact which seems in flat contradiction to what I have just advanced.
In investigating the opinions that have been formed upon the
antiquities of Europe, it is surprising to observe that the different
elements of our civilisation—the monarchical, theocratical,
aristocratical, and democratical principles—all lay claim to the
original proprietorship of the European society, and all pretend that
they have lost exclusive empire by the usurpations of contrary
principles. If we turn to all that has been written, and listen to all
that has been said, on this subject, we shall find that all the
systems by means of which our groundworks are sought to be
displayed or explained, maintain the exclusive predominance of one
or other of the elements of European civilisation.
Thus there is a school of feudal advocates, the most celebrated of
whom is M. de Boulainvilliers, who asserts that after the fall of the
Roman Empire, the conquering nation, subsequently formed into a
nobility, possessed all power and rights, that society was its
lordship, that kings and people have despoiled it, and that, in fact,
the aristocratic organisation was the primitive and veritable
constitution of Europe.
Alongside of this school we find that of the monarchists, amongst
whom is the Abbé Dubos, who maintain, on the contrary, that the
European society belonged to royalty. They say that the German
kings inherited all the rights of the Roman emperors, that the
ancient populations—the Gauls amongst others—appealed to them,
that they alone ruled legitimately, and that all the acquisitions of
aristocracy are mere encroachments upon monarchy.
A third school presents itself, that of liberals, republicans,
democrats, as you may choose to style them. If we follow the Abbé
de Mably, we shall conclude that the government of society was
handed over, from the dawning of the fifth century, to a system of
free institutions, to assemblies of free men, to the people properly
47. so called; that nobles and kings have enriched themselves with the
spoils of primitive liberty, which shrunk under their attacks, but
nevertheless reigned before them.
And above all these monarchical, aristocratical, and popular
pretensions, rises the theocratic claim of the church, which says
that, by virtue of her very mission and divine title, society belonged
to her, that she alone had any right to govern it, and that she alone
was the legitimate queen of the European world, reclaimed by her
labours to civilisation and truth.
Thus we are placed in a peculiar position. We imagined that we
had demonstrated that none of the elements of European
civilisation has had exclusive sway in the course of its history, but
that they have existed in a constant state of vicinage, of
amalgamation, of strife, and of activity; and at our very first step,
we find this directly contrary opinion maintained, that at its birth, in
the bosom of barbaric Europe, some one or other of these
elements had sole possession of society. And it is not in a single
country, but in all the countries of Europe, that the advocates for
the different principles of our civilisation have put forward their
irreconcilable pretensions, under forms and at periods somewhat
variable. The historical schools that we have just characterised are
not confined to one country, but are met throughout Europe.
This fact is important, not in itself, but because it brings to light
other facts which hold a material place in our history. Two
important particulars are started by this simultaneous advocacy of
the most incongruous pretensions to the exclusive possession of
power in the first ages of modern Europe. The first is the principle
or idea of political legitimacy, which has enacted a prominent part
in the drama of European civilisation: the second is the actual and
veritable character of the state of barbarian Europe of that epoch,
with which we have specially to concern ourselves at this period of
our inquiry.
48. I shall proceed to draw these two particulars from obscurity, and to
sever them in succession from the contest of allegations which I
have previously mentioned.
What do the different elements of European civilisation—the
theocratical, monarchical, aristocratical, and popular—claim when
they assert themselves the first possessors of society in Europe? Is
it not that each proclaims itself to be solely legitimate? Political
legitimacy is evidently a right based on antiquity and duration.
Priority of time is invoked as the source of right, as the proof of the
legitimacy of power. And here I beg attention to the fact, that this
pretension is not confined to one particular system or element of
our civilisation, but that it spreads over all. We are accustomed in
modern times to consider the idea of legitimacy as involved in only
one system—the monarchical—which is a great mistake, for it is at
issue in all the others. We have already seen that all the elements
of our civilisation have endeavoured to monopolise it; and if we
cast a look forward into the history of Europe, we shall see the
most varied social forms and governments equally in possession of
this character of legitimacy. The Italian and Swiss aristocracies and
democracies, the republic of San Marino, like the greatest
monarchies of Europe, have styled themselves, and have been
esteemed, legitimate; they, exactly like the others, have founded
their claim to legitimacy upon the antiquity of their institutions,
upon the historical priority, and upon the prolonged duration, of
their system of government.
If we go beyond Europe, and carry our observation to other times
and countries, we encounter on all sides this idea of political
legitimacy, and find it clinging to some portion of the ruling
government, to some of its institutions, forms, or maxims. There is
no country or time in which a certain portion of the social system,
of the public powers, has not bestowed upon itself, and had
recognised as inherent in it, this character of legitimacy derived
from antiquity and stability.
49. And what is this principle! What are its elements? How came its
introduction into European civilisation?
All systems of power are, at their origin, mixed up with force. I do
not mean to say that they are all based upon force alone, or that if
they had not originally had other titles than force, they would have
been established. They most certainly needed others; powers are
established in accordance with certain social wants, and with
reference to the state of society, to manners and opinions. But we
cannot avoid perceiving that force has sullied the foundation of all
the systems of power in the world, whatever may have been their
nature and form.
But every one repudiates this origin, all the systems of every
description deny it, and there is none that will consent to spring
from force. An invincible instinct apprises governments that force
does not confer right, and that if their claims rested upon that
alone, right could never be deduced. For this reason, when we
recur to ancient times, and unmask the different systems and
powers abandoned to violence, all hasten to exclaim, 'I was earlier,
I subsisted previously, and by virtue of other titles; society
belonged to me before this state of violence and strife in which you
discover me; I was legitimate; my just prerogatives were contested
and wrenched from me.'
This single fact demonstrates that the maxim of force is not the
groundwork of political legitimacy, and that it reposes upon some
other base. What is the effect of this formal repudiation of force by
all the systems? Their acknowledgment that there is another
legitimacy, the veritable foundation for all others, the legitimacy of
reason, justice, and right. Such is the origin to which they are all
eager to cling. And because they discard force as their initiatory
element, they are driven to assert themselves robed with a
different title, quoting their antiquity. The main characteristic, then,
of political legitimacy, is to deny force as the source of power, and
to allege it as cohesive with a moral idea and force, with the idea,
50. 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