DOM traversal under the hood
In Chapter 2, Selecting Elements, and again at the beginning of this chapter, we looked at ways of traveling from one set of DOM elements to another by calling DOM traversal methods. Our (far from exhaustive) survey of such methods included simple ways to reach neighboring cells, such as
.parent(), and more complex avenues of combining selector expressions, such as
.filter(). By now, we should have a fairly strong grasp of these ways of getting from one DOM element to another step-by-step.
Each time we take one of these steps, though, jQuery takes note of our travels, laying down a trail of breadcrumbs we can follow back home if needed. A couple of the methods we briefly touched on in that chapter, ...