On Jul 21, 2007, at 3:23 PM, Mitchell Waite wrote:
This concept of "walking" is something that I am not familiar with.
In fact I have to say that I am not well versed in the DOM and I
think that is lowering my ability to get the big picture, so that
is part of my work ahead. I certainly get the essence of your
point, which is the ability to take a collection of css and HTML
and manipulate it as a single element with JQuery and all its
tools. Is there a place I can learn all about the DOM that is not
super technical?
Hi Mitchell,
Here is a little snippet from the book (Learning jQuery) that might
help explain the DOM concept a bit:
++++++++++
One of the most powerful aspects of jQuery is its ability to make DOM
traversal easy. The Document Object Model is a family-tree structure
of sorts. HTML, as well as other markup languages, uses this model to
describe the relationships of things on a page. When we refer to
these relationships, we use the same terminology that we use when
referring to family relationships: parents, children, and so on. A
simple example can help us understand how the family tree metaphor
applies to a document:
<html>
<head>
<title>the title</title>
</head>
<body>
<div>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<p>This is yet another paragraph.</p>
</div>
</body>
</html>
Here, <html> is the ancestor of all the other elements; or, in other
words, all the other elements are descendants of <html>. The <head>
and <body> elements are children of <html>. Therefore, in addition to
being the ancestor of <head> and <body>, <html> is also their parent.
The <p> elements are children (and descendants) of <div>, descendants
of <body> and <html>, and siblings of each other.
++++++++++
When Scott refers to "walking" the DOM, he's talking about accessing
elements in your HTML by moving "up" from child to parent or "down"
from parent to child or "across" from sibling to sibling.
Does that make sense?
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com