Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Is there a difference between a parent.node and a parent in a dom tree?
I read "Inherits properties from its parents Node, and its own parent, EventTarget, and implements those of ParentNode, ChildNode, NonDocumentTypeChildNode, and Animatable."
The first part makes it sound like they're different, which is a bit confusing, because in a dom tree all children are nested within their parent, so wouldn't all parents be nodes? Are they the same or am I not understanding something correctly?
"The jQuery .parent() selector selects the immediate parent of all the nodes in the node set. However, since in your example the node set is just one node $(this), there's little practical difference.
This difference matters if you were to do something like $(".foo").parent(), where there might be many nodes that have the class foo."