@@ -64,8 +64,9 @@ where elements can contain sub-elements that are similar to
6464themselves.
6565
6666We call a data structure a _tree_ when it has a branching structure,
67- no cycles (a node may not contain itself, directly or
68- indirectly), and has a single, well-defined “root”.
67+ no cycles (a node may not contain itself, directly or indirectly), and
68+ has a single, well-defined “root”. In the case of the DOM,
69+ `document.documentElement` serves as the root.
6970
7071Trees come up a lot in computer science. Apart from representing
7172recursive structures like HTML documents or programs, they are also
@@ -142,11 +143,10 @@ following diagram tries to illustrate these.
142143
143144image::img/html-links.svg[alt="Links between DOM nodes",width="6cm"]
144145
145- Although the diagram only shows one link of each type,
146- every node has a `parentNode` property
147- that points to its containing node. Likewise, every element
148- node (node type 1) has a `childNodes` property that points to an
149- array-like object holding its children.
146+ Although the diagram only shows one link of each type, every node has
147+ a `parentNode` property that points to its containing node. Likewise,
148+ every element node (node type 1) has a `childNodes` property that
149+ points to an array-like object holding its children.
150150
151151In theory, you could move anywhere in the tree using just these
152152parent and child links. But JavaScript also gives you access to
@@ -495,12 +495,13 @@ is called `className`. You can also access it with the
495495
496496== Layout ==
497497
498- You might have noticed that different types of elements are laid out differently.
499- Some, such as paragraphs (`<p>`) or headings (`<h1>`), take up the
500- whole width of the document, and are placed below each other.
501- These are called _block_ elements. Others, such as links (`<a>`) or
502- the `<strong>` element used in the example above, are treated as part
503- of the surrounding text. Such elements are called _inline_ elements.
498+ You might have noticed that different types of elements are laid out
499+ differently. Some, such as paragraphs (`<p>`) or headings (`<h1>`),
500+ take up the whole width of the document, and are rendered on separate
501+ lines. These are called _block_ elements. Others, such as links
502+ (`<a>`) or the `<strong>` element used in the example above, are
503+ rendered on the same line with their surrounding text. Such elements
504+ are called _inline_ elements.
504505
505506For any given document, browser are able to compute a
506507layout, which gives each element a size and position based on its type
@@ -722,10 +723,11 @@ p.a.b#main {
722723----
723724
724725The precedence rule favoring the most recently defined rule only holds
725- when the rules have the same _specificity_. Specificity depends on the
726- amount of aspects of the tag that the rule matches. For example, `p.a`
727- is more specific than just `p` or just `.a`, so a rule defined as such would take
728- precedence to them.
726+ when the rules have the same _specificity_. A rule's specificity is a
727+ measure of how precisely it describes matching elements, determined by
728+ the number and kind (tag, class, or id) of element aspects it
729+ requires. For example, `p.a` is more specific than just `p` or just
730+ `.a`, so a rule defined as such would take precedence to them.
729731
730732The notation `p > a {…}` applies the given styles to all `<a>` tags
731733that are direct children of `<p>` tags. Similarly, `p a {…}` applies
0 commit comments