Javascript Programmer S Reference 1St Ed. Edition Valentine Download PDF
Javascript Programmer S Reference 1St Ed. Edition Valentine Download PDF
Edition
Valentine download pdf
https://ebookultra.com/download/javascript-programmer-s-reference-1st-
ed-edition-valentine/
https://ebookultra.com/download/vbscript-programmer-s-reference-3rd-
ed-edition-adrian-kingsley-hughes/
https://ebookultra.com/download/excel-2007-vba-programmer-s-reference-
programmer-to-programmer-1st-edition-john-green/
https://ebookultra.com/download/visual-basic-2008-programmer-s-
reference-rod-stephens/
https://ebookultra.com/download/access-2007-vba-programmer-s-
reference-1st-edition-teresa-hennig/
Professional JavaScript Frameworks Prototype YUI ExtJS
Dojo and MooTools Wrox Programmer to Programmer 1st
Edition Leslie M. Orchard
https://ebookultra.com/download/professional-javascript-frameworks-
prototype-yui-extjs-dojo-and-mootools-wrox-programmer-to-
programmer-1st-edition-leslie-m-orchard/
https://ebookultra.com/download/javascript-a-beginner-s-guide-3rd-ed-
edition-pollock/
https://ebookultra.com/download/wpf-programmer-s-reference-windows-
presentation-foundation-with-c-2010-and-net-4-1st-edition-rod-
stephens/
https://ebookultra.com/download/javascript-creativity-exploring-the-
modern-capabilities-of-javascript-and-html5-1st-ed-edition-hudson/
https://ebookultra.com/download/beginning-javascript-3rd-ed-edition-
paul-wilton/
JavaScript Programmer s Reference 1st ed. Edition
Valentine Digital Instant Download
Author(s): Valentine, Thomas, Reid, Jonathan
ISBN(s): 9781430246299, 1430246294
Edition: 1st ed.
File Details: PDF, 2.82 MB
Year: 2013
Language: english
JavaScript Programmer’s
Reference
Jonathan Reid
Thomas Valentine
Apress
JavaScript Programmer’s Reference
Copyright © 2013 by Jonathan Reid and Thomas Valentine
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material
is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting,
reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material
supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the
purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the
Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from
Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are
liable to prosecution under the respective Copyright Law.
ISBN 978-1-4302-4629-9
ISBN 978-1-4302-4630-5 (eBook)
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified
as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither
the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may
be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
President and Publisher: Paul Manning
Lead Editor: Ben Renow-Clarke
Technical Reviewers: RJ Owen
Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Louise Corrigan, Morgan Ertel,
Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham,
Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,
Gwenan Spearing, Matt Wade, Tom Welsh
Coordinating Editor: Christine Ricketts
Copy Editors: William McManus and Mary Bearden
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit
www.springeronline.com Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science +
Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected], or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions
and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing
web page at www.apress.com/bulk-sales.
Any source code or other supplementary materials 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/.
For Mom and Dad, who have always been there for me.
—Jon Reid
Index .................................................................................................................................269
v
Contents
Summary .....................................................................................................................................23
vii
N CONTENTS
Operators.....................................................................................................................................29
Precedence .......................................................................................................................................................... 30
Variables......................................................................................................................................32
Declaring Variables in JavaScript ........................................................................................................................ 32
Understanding Variable Scope in JavaScript ....................................................................................................... 33
Managing Variables in JavaScript ....................................................................................................................... 35
Objects ........................................................................................................................................37
Inheritance........................................................................................................................................................... 37
Accessing Properties and Enumeration ............................................................................................................... 37
Creating Objects .................................................................................................................................................. 39
Arrays ..........................................................................................................................................41
Dynamic Length ................................................................................................................................................... 41
Accessing and Assigning Values.......................................................................................................................... 41
Creating Arrays .................................................................................................................................................... 42
Functions.....................................................................................................................................45
Function Declarations .......................................................................................................................................... 45
Function Expressions........................................................................................................................................... 46
Conditionals.................................................................................................................................51
if Statements ....................................................................................................................................................... 51
switch Statements ............................................................................................................................................... 52
viii
N CONTENTS
Loops ...........................................................................................................................................53
for Loops.............................................................................................................................................................. 53
for-in Loops ......................................................................................................................................................... 54
while Loops ......................................................................................................................................................... 55
do Loops .............................................................................................................................................................. 55
Summary .....................................................................................................................................56
ix
N CONTENTS
x
N CONTENTS
Boolean .....................................................................................................................................140
Boolean Methods ............................................................................................................................................... 141
Date ...........................................................................................................................................142
Date Methods .................................................................................................................................................... 142
Math ..........................................................................................................................................159
Math Properties ................................................................................................................................................. 160
Math Methods.................................................................................................................................................... 160
Number......................................................................................................................................166
Number Properties ............................................................................................................................................ 166
Number Methods ............................................................................................................................................... 166
RegExp ......................................................................................................................................168
RegExp Properties ............................................................................................................................................. 168
RegExp Methods ................................................................................................................................................ 170
String .........................................................................................................................................171
String Properties................................................................................................................................................ 172
String Methods .................................................................................................................................................. 172
Summary ...................................................................................................................................184
xi
N CONTENTS
if ................................................................................................................................................188
label...........................................................................................................................................189
return ........................................................................................................................................190
switch/case ...............................................................................................................................190
while..........................................................................................................................................192
with ...........................................................................................................................................192
Summary ...................................................................................................................................193
xii
N CONTENTS
Summary ...................................................................................................................................207
Summary ...................................................................................................................................268
Index .................................................................................................................................269
xiii
About the Authors
Jonathan Reid has been building web-based applications since 1996 and is passionate about creating awesome and
compelling user experiences on the web. He is a firm believer in user-centered creative processes and is an advocate
for standards and accessibility. Jon has a wide range of experience developing web applications, ranging from
genetic analysis software to cutting-edge advertising. Jon teaches courses in JavaScript, jQuery, and jQuery Mobile,
and has written extensively on all three topics. Jon bet his career on web technologies early on, and he is happy to
see his bet paying off.
Jon is an alumnus of the University of Colorado, Boulder, where he graduated with a degree in physics and
mathematics. He currently works as a Senior JavaScript Developer at Google, and lives in Sunnyvale, California with
his partner of 15 years. He occasionally tweets as @jreid01 and blogs even more occasionally at
webdev.dreamwidth.org.
Thomas Valentine lives in the small town of Selkirk, Manitoba, Canada on the shores of the Red River. His love of the
written word has shaped his career and life and will continue to do so for many years to come.
xv
About the Technical Reviewer
xvii
Introduction
JavaScript has seen a huge increase in popularity in the last decade. Originally used to create interactive web pages
and handle basic form validation, JavaScript is now the backbone of many complex web applications. As a result,
people who can program well with JavaScript are in high demand for a wide range of projects. If you want to work with
web technologies, you should know JavaScript.
This book aims to provide both a complete reference for JavaScript and to cover the fundamentals of the
language. Our overall goal was to cover all the topics you need to work with JavaScript in projects of any size.
Overview
This book is divided into two sections. The first section is devoted to teaching the basics of JavaScript and its related
technologies. The second section is devoted to reference.
r Chapter 1 is aimed at the programmer who is coming to JavaScript from another language.
JavaScript is a much more dynamic language than most of the common languages, and
moving to JavaScript from those languages can present special challenges. First we cover what
JavaScript is and how it came to be, and then we dive right into the three main challenges that
programmers of other languages encounter: JavaScript’s object inheritance and lack of classes,
its rules for scoping, and its dynamic typing. All of these features work quite differently in
JavaScript than they do in other languages, and we want to get into them immediately. We wind
up the chapter by providing some common patterns in JavaScript that use what we have learned.
r Chapter 2 is an overall reference for the JavaScript language. We start at the beginning, with
JavaScript’s lexical structure, and quickly move into its operators, how it handles variables,
JavaScript’s take on objects, arrays, and functions. We wind up the chapter by going
over JavaScript’s flow control statements. Chapter 2 covers some of the things mentioned in
Chapter 1 in more detail. Together they form a solid introduction to the language, all the way
from the basics to intermediate concepts like closures.
xix
N INTRODUCTION
r Chapter 3 covers the Document Object Model. While the DOM is not technically a part of
JavaScript, we include a chapter on it because chances are a significant amount of the work
you’ll be doing with JavaScript will involve the DOM. The chapter starts with a brief history of
the DOM standard and how it has evolved. Then we dive right into the details: how to access
page elements, how to manipulate them (including creating new elements and deleting
existing ones), and the event model provided by the DOM (including custom events). We wind
up the chapter with a discussion of cross-browser strategies for dealing with variations in the
implementation of the DOM from browser to browser.
r Chapter 4 takes everything we have learned in Chapters 1, 2, and 3 and puts them to work.
We’ve divided the chapter up into sections, and each section covers something different.
The first section, Working with JavaScript, covers what you need to get to work with JavaScript.
We cover basic workflows as well as tools and debugging techniques. The second section
covers increasing the efficiency of your JavaScript applications by closely examining how
browsers load and parse scripts, and how you can use that to your advantage. The third section
covers asynchronous communication using the XMLHTTP object—otherwise known as
AJAX. The fourth section covers an important security limitation imposed by browsers—the
single origin policy—and some techniques for working with that policy and still getting your
work done. In the firth section we provide a practical example of data caching. Section six is
all about choosing JavaScript libraries, and section seven covers the most popular JavaScript
library, jQuery. Finally, we wrap up the chapter with a practical example of building your own
library using everything we have learned so far in the chapter.
r Chapter 5 begins the reference section of the book, and covers the objects that are a part
of JavaScript.
r Chapter 6 provides a reference for JavaScript’s control statements.
r Chapter 7 is all about JavaScript operators.
r Chapter 8 is a DOM reference.
Even though they are reference chapters, we have tried to provide useful, nontrivial examples throughout.
Code Downloads
All of the code snippets and examples are available for download from http://www.apress.com/9781430246299. This
download includes all of the example code in the book, as well as some extra bits that didn’t make it into the book
itself. We encourage you to download the code and work with it as you go through the text.
xx
CHAPTER 1
JavaScript Basics
In this chapter we are going to take a different approach from what you’ll find in the first chapter of most
programming language references. Most books would dive right into the syntax and other details of the language, but
we are not going to do that here. JavaScript is a surprisingly difficult language to learn, and a relatively easy one to
dislike, so we first want to explore why some people struggle with it, and then we’ll provide a different, more intuitive
approach to mastering the language.
We will begin by examining the challenges of learning and working with JavaScript. We’ll cover a bit of
background by examining the language’s evolutionary history and implementations. Then, armed with that
information, we’ll examine the three specific areas where JavaScript is a challenge: its inheritance metaphor, its
scoping metaphor, and its typing metaphor. We’ll finish up by examining two very common patterns in JavaScript—a
topic most books wouldn’t cover until much later, but which we think you’ll be amply prepared to handle by the end
of this chapter. The patterns also serve as good applications of everything you will have learned in the chapter.
As we go through this chapter, we’ll cover the bare bones basics of JavaScript as we encounter them, but we
encourage you to not get too bogged down in considerations of syntax or other details at this stage. We’ll cover those
topics in later chapters. For now, concentrate on the bigger picture we’re about to paint.
1
CHAPTER 1 N JAVASCRIPT BASICS
Lest we scare you away from the language, it’s important to realize that many times this low opinion is due to
misunderstanding how JavaScript works, or attempting to apply practices from other languages that don’t map well to
how JavaScript behaves. We have found that the more a developer is willing to learn about JavaScript, the more they
appreciate it. That’s true to some extent for any language, of course, but it’s especially true for JavaScript. Its dynamic
nature and true functionality are difficult to understand but once you do understand it the language starts to take on a
beauty and simplicity that very few languages possess.
Our approach to teaching JavaScript is designed to help you form that level of understanding of JavaScript before
we even begin covering details like functions, arrays, and flow control. We’ll cover those things as well, and in great
detail, but before we do we want to address head-on the major things that people find confusing or difficult about
JavaScript. In so doing we hope to start you down your journey of mastering JavaScript. The first step in that mastery is
understanding the origins of JavaScript and its continuing evolution.
What Is JavaScript?
JavaScript is a programming language that was first released in 1995. Despite its name, JavaScript actually has nothing
to do with the Java programming language. From a high level, JavaScript has several notable features:
u It is a scripting language: JavaScript programs are “scripts” that are read and executed by an
interpreter (or engine). This is distinguished from compiled languages, in which programs are
read by a compiler and translated into an executable file. (Note that often JavaScript engines
themselves are written in a compiled language.) Programs written in scripting languages are
highly portable in that they can run in any environment where an interpreter for that language
has been built.
u It is C-like: JavaScript’s basic syntax and structure borrow heavily from C.
u It is an object-oriented language: JavaScript differs from most object-oriented languages,
though, in that its inheritance model is prototype-based rather than class-based.
u It has first-class functions: JavaScript functions are full-fledged objects and have their own
properties and methods, and may be passed into other functions as parameters or returned
from other functions and assigned to variables.
u It is dynamic: The term “dynamic programming language” is broad and covers a lot of features.
JavaScript’s most dynamic features are its implementation of variable typing (see next point)
and its eval() method and other functional aspects.
u It is both dynamically typed and weakly typed: JavaScript variables are not type-checked at
interpretation time (making JavaScript a dynamically typed language), and how operations
occur between operands of mixed types depends on specific rules within JavaScript (making
JavaScript a weakly typed language).
u It is an implementation of a standard: As described in the following section, JavaScript is
actually an implementation of the ECMA-262 standard, just as the C programming language is
governed by an ISO standard.
These major features combine to make JavaScript somewhat unique. They also help make JavaScript basics
fairly easy to learn if you have a passing familiarity with C-like languages, because you’ll have very little problem with
JavaScript’s syntax or structure.
JavaScript is also heavily influenced by Scheme, another functional programming language that is a dialect of
Lisp. JavaScript gets many of its design principles from Scheme, including its scoping.
So how did JavaScript come to have this unique combination of features?
2
CHAPTER 1 N JAVASCRIPT BASICS
JavaScript Implementations
JavaScript has been implemented in several different ways. Adobe’s Acrobat document system, for example,
implements a version of JavaScript that enables users to employ simple scripts in Acrobat documents. JavaScript
engines have also been implemented as stand-alone resources on Windows, UNIX, and Linux for quite some
time. Shortly after it first introduced JavaScript in 1995, Netscape included a server-side implementation of it in its
Enterprise Server. Today, the most notable implementation of server-side JavaScript is in the Node.js software system.
By far the most common implementations of JavaScript are in web browsers. A web browser’s JavaScript
engine typically implements most of the features specified in the ECMA-262 standard. In addition, browsers often
extend JavaScript with other features not specified by the ECMA standard. The most notable of these extensions
3
CHAPTER 1 N JAVASCRIPT BASICS
is the Document Object Model, or DOM, which is a separate standard that is maintained by the World Wide Web
Consortium (W3C). It’s important to remember that the DOM and JavaScript are separate, independent standards,
though much of the work JavaScript does in the browser involves manipulating the DOM. We will cover the DOM in
more depth in Chapter 3.
Though JavaScript started its life as a browser-based scripting language, server-side implementations of
JavaScript are becoming more and more common. On the server side, a JavaScript implementation will include
most of the base features of ECMA-262. And, like browser-based implementations, server implementations can
extend JavaScript with other features, such as libraries or frameworks. Though server and browser JavaScript
implementations may differ on these extended features, the base features are the same: the JavaScript Array object
has the same methods and properties whether it is implemented in the browser or on the server (assuming the
implementation follows the ECMA standard, of course).
This makes your JavaScript skills particularly valuable. JavaScript is one of the few languages that has both client
and server implementations, so learning JavaScript is a good investment. With the use of Node.js on the server side,
along with client-side scripts, it is possible to build complex, data-driven applications with rich user interactions using
JavaScript as the primary language.
Probably two of the best examples of using JavaScript on both the client and the server are Microsoft’s Windows
Azure Platform and Windows Software Development Kit for Windows 8 (Windows SDK). Both of them support using
JavaScript for both back- and front-end implementations, making it possible to build Windows apps in JavaScript and
leverage all the power of Microsoft’s platforms.
We will not cover server-side JavaScript with Node.js in this book, but instead will focus on JavaScript in the
context of a web browser.
4
Random documents with unrelated
content Scribd suggests to you:
und vornehmlich gehörig«.[81] Diese Ehe endete bekanntlich mit
dem geheimnisvollen Tode der eines zuchtlosen Wandels
beschuldigten Jakobäa.[82]
Verlobung und Hochzeit folgten bei Bürgern und Bauern häufig
unmittelbar aufeinander, namentlich wenn eine feierliche Verlobung
stattgefunden hatte; doch kommt es auch vor, dass dem
ungeduldigen Bräutigam eine Wartezeit auferlegt wird, so Gudruns
Verlobten Herwig, der ein ganzes Jahr warten muss, wobei ihm aber
von der Schwiegermutter hochherzig gestattet wird, dass er sich
»mit schoenen wîben vertribe anders wâ Die zît«. Vom 8.
Jahrhundert ab begehrte die Geistlichkeit ein dreimaliges Aufgebot
und die kirchliche Einsegnung der Ehe. Die höhere Gesellschaft fügte
sich diesem Anspruche sofort, nicht so die breiteren Schichten des
Volkes, denen auf noch lange die einfache bürgerliche
Eheschliessung genügte »an (ohne) schuoler und an phaffen«, den
Bauern sogar bis ins 15. Jahrhundert. Aber selbst der Hochadel
verfügte sich erst am Morgen nach der Brautnacht zur Kirche.
Abends vor dem Kirchgange wurde das Brautpaar in die
Brautkammer gebracht, eine Decke beschlägt sie beide, ein
Geistlicher findet sich vielleicht ein, den Brautsegen über das Paar zu
sprechen.[83] Die Freundinnen und nächsten Angehörigen sind der
Braut beim Entkleiden behilflich, ihr manch guten Rat dabei
zuflüsternd. Oft sind auch der Brautvater, der Bruder des Bräutchens
oder andere aus der Sippschaft in dem Gemache anwesend.
»Wie Elsa von Brabant, die schöne, keusche Magd,
Dem Fürsten werth des Nachts ward zugesellet.
Die Kaiserin nicht unterliess,
Dass sie die Fürstin selbst des Nachts zu Bette wies.
Die Kammer war mit Decken wohlbestellet.
Das Bett war schön geziert, mit Golde roth und reicher Seiden,
Und manches Thier darein gewoben.
In dieses Bett hat sich die Jungfrau nun gehoben,
Um drin der Minne Buhurd zu erleiden.
Der Kaiser auch gekommen war,
Er hiess die Kammer das Gesinde räumen gar,
Gut Nacht gab er den Beiden miteinander.
Nun ward die Maid entkleidet schier,
Es drückte sie der Degen an sich stolz und zier:
Ich sag' nicht mehr als – was er sucht', das fand er.«[84]
sagt Freidank.
Von den Ditmarschen ist bekannt, dass niemand von ihnen ein
gefallenes Mädchen ehelichen durfte, denn »de eine hôre nimt
vorsatzichlich, vorrêt ôk wol sîn vaterland«, und als Landesverräter
wegen seiner Ehe zu gelten, wagte kein echter Friese. Zu Bonifazius'
Zeiten war das Mädchen gezwungen, sich aufzuhängen. Über den
Scheiterhaufen der Toten knüpfte man den Verführer auf.[91] Das
Landrecht des als unkeusch verschrieenen Schwabens enthält eine
Stelle, die ungefähr folgendermassen lautet: Wenn ein Mann sich
eine Gattin genommen hatte, und beschuldigte sie, sie wäre bei der
Hochzeit nicht mehr Jungfrau gewesen, so waren die Eltern des
Mädchens verpflichtet, den Gegenbeweis anzutreten. Dieses geschah
dadurch, dass man »jr junckfraulichnn zaichnn«, das heisst das
Bettuch, auf dem sie die erste Nacht gelegen hatte, vor Gericht
brachte. Wenn man nun an diesem erkannte, dass sie eine reine
Magd gewesen, so wurde der Mann für seine Verleumdung mit 40
Schlägen und einer Geldbusse bestraft und er war gezwungen, das
Mädchen als Ehefrau zu behalten; zeigte es sich aber, dass das Weib
seine Jungfräulichkeit früher verloren hatte, so wurde sie aus dem
Hause des Vaters verstossen, »darumb daz sy hurhait pflegnn hat in
irs vaters haus«. In einigen Gegenden, wie im Thüringischen,
handhabte man die Unzuchtsstrafe noch bis ins 16. Jahrhundert
derart, dass eine zur Unehre gekommene Dirne sofort in Haft
genommen, ebenso der Thäter, falls man seiner habhaft werden
konnte, gefangen gesetzt wurde, bis die Trauung stattfand. Wollte
der Bräutigam nicht »Ja« sagen, so that es der Gemeindediener für
ihn: »Montag den 7. September 1579 sind Matthes Bechtold von
Neustadt vnd Agnes Bäuerin von Coburgk, da sie von wegen geübter
Vnzucht und Hurerey Kirchenbuss gethan vnd der Obrigkeitt straffe
mit gebührlichen vnd willig gehorsam vff sich genommen, in der
Büttelstube copulirt vnd ehelichen zusammen gegeben worden, auf
das in ihr Kindlein, mit welches geburt die Mutter alda vberfallen,
also cohenestirt, vnd von allen vnehren erledigt würde.«[92]
Die Kirchenbussen waren, wie ich bereits bemerkte, ungleich
empfindlicher als die Strafen der Sittenpolizei. Personen mit
derartigen Delikten mussten vor Beginn der Messe mit einem
weissen Stabe in der Hand oder Strohkränzen auf dem Kopfe, das
Mädchen in Konstanz ausserdem mit einem Strohzopf vor der
Kirchthüre stehen; in Rottenburg der Verführer in einem Strohmantel
an drei Sonntagen in der Kirche sein. In den Dörfern oberhalb
Rottenburgs musste er seine Liebste in einem Karren herumfahren,
wobei die Jugend und die lieben Nächsten das Paar mit Schmutz
bewarfen, ehe es von der Kanzel herab öffentlich seine Busse
auferlegt erhielt.[93] In gewissen Fällen wurden die Dirnen
ausgepeitscht und des Landes verwiesen.
Ein Hauptbestandteil des Lobes, das Tacitus dem germanischen
Eheleben spendet, besteht in der Hervorhebung der bei ihnen
herrschenden Einweiberei: »Denn sie sind fast die einzigen
Barbaren, die sich mit Einem Weibe begnügen; eine Ausnahme
machen sehr wenige unter ihnen, und diese nicht aus Sinnenlust,
sondern weil sie ihres hohen Standes wegen mehrfach umworben
werden.«[94] Also Ausnahmen kamen vor, wie z. B. Ariovists Bigamie
aus politischen Gründen, ferner bei den Merovingern und vornehmen
Franken, so bei Pipin II., der zwei rechtmässig angetraute Frauen,
Plectrud und Alpais, besass, ohne dass die Kirche dagegen Einspruch
zu erheben wagte. Ja, die Kirche wusste stets den Launen der
Mächtigen willfährig zu sein, denn auch sie war sich des Spruches
»Mit grossen Herren ist nicht gut Kirschen essen« bewusst, und –
eine Hand wusch eben die andere. So bleibt, aller Beschönigungen
zum Trotze, jene so viel angefochtene und anfechtbare Billigung
Luthers und Melanchthons zu der am 4. März 1540 geschlossenen
Doppelehe Philipps des Grossmütigen von Hessen mit der schönen
Sächsin Margarete von Sal, dem Hoffräulein seiner Gemahlin, als
hässlicher Fleck auf dem Charakterbilde dieser beiden grossen
Männer haften.
Die Angelegenheit erregte um so grösseres und unliebsameres
Aufsehen, als das kurz vorher in Kraft getretene Strafgesetzbuch
Kaiser Karls V. die Bigamie, »welche übelthat dann auch eyn
ehebruch und grösser dann das selbig laster ist« mit dem Tode
bestraft wissen wollte. Gegen weniger hochgeborene Übelthäter
dieser Art kannte das Gesetz keine Nachsicht, und Meister Franz, der
Nürnberger Scharfrichter, kann in seinen Aufzeichnungen[95] von
vollzogenen Hinrichtungen an Bigamisten, selbst Trigamisten
erzählen. Nur ein einziges Mal war in der deutschen Geschichte die
Doppelehe nicht nur gesetzlich gestattet, sondern sogar behördlich
angeordnet. Nach dem grossen Kriege war es, der Deutschlands
Bevölkerung von sechzehn bis siebzehn Millionen auf etwa vier
Millionen verringert hatte. Diesem Menschenmangel suchte man
durch zum Teil befremdliche Auskunftsmittel zu steuern. Ein solches
war unter anderen der am 14. Februar 1650 von dem fränkischen
Kreistag in Nürnberg gefasste folgende Beschluss: »Demnach auch
die unumgängliche dess heyl. Römischen Reichs Notthürft erfordert,
die in diesem 30 Jerig blutigen Krieg ganz abgenommene, durch das
Schwerdt, Krankheit und Hunger verzehrte Mannschaft wiederumb
zu ersetzen und in das khünfftig eben dersselben Feinden,
besonders aber dem Erbfeind des christlichen Namen, dem
Türckhen, desto stattlicher gewachsen zu sein, auf alle Mitl, Weeg
und Weiss zu gedenkhen, als seinds auff Deliberation und
Berathschlagung folgende 3 Mittel vor die bequembste und
beyträglichste erachtet und allerseits beliebt worden. 1.) Sollen
hinfüro innerhalb den nechsten 10 Jahren von Junger mannschaft
oder Mannsspersonen, so noch unter 60 Jahren sein, in die Klöster
ufzunemmen verbotten, vor das 2te denen Jenigen Priestern,
Pfarrherrn, so nicht ordersleuth, oder auff den Stifftern Canonicaten
sich Ehelich zu verheyrathen; 3.) J e d e m M a n n s s p e r s o n e n 2
We i b e r z u h e y r a t h e n e r l a u b t s e i n : dabey doch alle und Jede
Mannssperson ernstlich erinnert, auch auff den Kanzeln öffters
ermanth werden sollen, Sich dergestalten hierinnen zu verhalten und
vorzusehen, dass er sich völlig und gebürender Discretion und
versorg befleisse, damit Er als ein Ehrlicher Mann, der ihm 2 Weyber
zu nemmen getraut, beede Ehefrauen nicht allein nothwendig
versorge, sondern auch under Ihnen allen Unwillen verhüette.[96]«
Die Ehescheidung kam im Mittelalter verhältnismässig selten vor.
Zu den Scheidungsgründen in der Übergangsperiode vom Altertum
zum Mittelalter zählten einerseits Ehebruch, Mordversuch, Zauberei
und Gräberschändung, andererseits zu hohes Alter des einen der
Gatten, Unvermögen und Verweigerung der ehelichen Pflicht und
böswilliges Verlassen.[97] Die offen und vor Zeugen geschlossene
Ehe konnte nur wieder vor Zeugen aus beiden Familien rechtlich
gelöst werden.[98] Als sich ein geordnetes Gerichtsverfahren gebildet
hatte, wurde in aller Form der Ehescheidungsprozess geführt und
das richterliche Erkenntnis öffentlich bekannt gemacht. Die Kirche
strebte von Anbeginn bis zu ihrer vollen Machtentfaltung danach, die
Scheidung möglichst zu erschweren. Die Nichtigkeitserklärung der
Ehen konnte nur in Rom erfolgen, war daher für einen minder
Bemittelten schwer, ja geradezu unmöglich. Desto mehr Gebrauch
machten davon die Fürsten. Waren sie ihrer Frauen überdrüssig,
oder boten sich durch eine andere Heirat neue Vorteile, so wurden,
wenn kein anderer plausibler Scheidungsgrund aufzutreiben war,
Zeugen beschafft, von denen das Vorhandensein eines verbotenen
Verwandtschaftsgrades zwischen den Ehegatten beschworen wurde;
Geld und Ansehen thaten das übrige, so dass die Lösung der Ehe
durch päpstliche Gewalt keine Schwierigkeiten machte.
Später wurde durch den Wegfall der meisten der vorangeführten
Scheidungsgründe die Lösung der Ehe noch weiter erschwert. Selbst
Ehebruch der Frau wurde 829 schon als kein Grund zur Auflösung
der Ehe betrachtet, ebensowenig wie das geschlechtliche
Unvermögen. Hatte der Bauer seine Frau dem Nachbarn anzubieten
(s. oben Seite 65), so sah man in der Frühzeit nichts Übles darin,
wenn der Gatte sich einen, wenn angängig möglichst vornehmen,
dabei natürlich möglichst kräftigen Stellvertreter suchte. Ein
thüringer Ritter, der wegen Unvermögen keinen Erben von seiner
Frau erhalten konnte, bat den Landgrafen Ludwig, den Gemahl der
heiligen Elisabeth, ihn zu vertreten. Mit der Verleitung der eigenen
Frau zum Ehebruch hatte ein derartiges Ansuchen um so weniger zu
thun, als in einem solchen Falle jedes materielle Interesse in Wegfall
kam und der Mann nur den derzeitigen Hauptzweck der Ehe, die
Erhaltung und Fortpflanzung der Familie, im Auge hatte.
In einer Zeit, in der die kirchliche Lehre von der Verdienstlichkeit
ehelicher Enthaltsamkeit Eingang fand, als der höchsten Frivolität
eines Teiles der Gesellschaft die überspannteste Frömmigkeit
gegenüberstand, blieben oder wurden manche Ehen bloss
Scheinehen. Die Geistlichkeit pries dies sehr unlogisch, da sie doch
die Ehe als Sakrament erklärt hatte, als ein heiliges Werk, dem der
höchste Lohn im Jenseits gewiss war. Einige Fürstinnen und Fürsten
erwarben sich durch dieses freiwillige und unter erschwerenden
Umständen aufrecht erhaltene Cölibat den Heiligenschein. Sehr
vernünftig erklärte sich aber die Synode von Schwerin anno 1492
gegen diesen asketischen Blödsinn. Ich habe bereits früher, beim
Rittertum (Seite 49) einige dieser »Martyrerinnen« und Heiligen
namhaft gemacht, die neben anderem Unsinn auch den Sport
trieben, jungfräuliche Ehefrauen zu sein, die selbst den
Verführungen der Flitterwochen nicht unterlegen waren, die die
Vorzeit viel bezeichnender als wir: Kusswoche, Kirchenwoche,
Zärtel-, Butter- und Honigwoche nannte.
Wie alles, was vom Menschen kommt und mit dem Schicksal
zusammenhängt, hat auch die Ehe ihre Licht- und Schattenseiten,
daher begeisterte Anhänger und erbitterte Widersacher. Einer der
eifrigsten Fürsprecher der Ehe war D. Martinus Luther. »Die Ehe ist
eine schöne herrliche Gabe und Ordnung«, dann weiter, dass der
Ehestand »Gottes Ordnung und der allerbeste und heiligste Stand
sei; darum sollte man ihn auch mit den herrlichsten Ceremonien
anfahen um des Stifters willen, nehmlich Gottes, der da will, dass ein
Männlein und ein Fräulein beisammen sein sollen« u. s. w.[99]
Freidank, ohnehin ein begeisterter Lobredner der Frauen, bei dem
sich das schönere Geschlecht für das sinnige Kompliment zu
bedanken hat:
Dann:
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.
ebookultra.com