--- title: ParentNode slug: Web/API/ParentNode tags: - API - DOM - Finding Elements - Finding Nodes - Interface - Locating Elements - Locating Nodes - Managing Elements - Managing Nodes - Mixin - NeedsTranslation - Node - ParentNode - Reference - Selectors - TopicStub translation_of: Web/API/ParentNode ---
The ParentNode
mixin contains methods and properties that are common to all types of {{domxref("Node")}} objects that can have children. It's implemented by {{domxref("Element")}}, {{domxref("Document")}}, and {{domxref("DocumentFragment")}} objects.
See Locating DOM elements using selectors to learn how to use CSS selectors to find nodes or elements of interest.
ParentNode
which are elements.ParentNode
, omitting all of its non-element nodes.ParentNode
and is also an Element
, or null
if there is none.ParentNode
and is an Element
, or null
if there is none.ParentNode
. {{domxref("DOMString")}} objects are inserted as equivalent {{domxref("Text")}} nodes.ParentNode
. {{domxref("DOMString")}} objects are inserted as equivalent {{domxref("Text")}} nodes.Specification | Status | Comment |
---|---|---|
{{SpecName('DOM WHATWG', '#parentnode', 'ParentNode')}} | {{Spec2('DOM WHATWG')}} | Split the ElementTraversal interface into {{domxref("ChildNode")}} and {{domxref("ParentNode")}}. The {{domxref("ParentNode.firstElementChild")}}, {{domxref("ParentNode.lastElementChild")}}, and {{domxref("ParentNode.childElementCount")}} properties are now defined on the latter. Added the {{domxref("ParentNode.children")}} property, and the {{domxref("ParentNode.querySelector()")}}, {{domxref("ParentNode.querySelectorAll()")}}, {{domxref("ParentNode.append()")}}, and {{domxref("ParentNode.prepend()")}} methods. |
{{SpecName('Element Traversal', '#interface-elementTraversal', 'ElementTraversal')}} | {{Spec2('Element Traversal')}} | Added the initial definition of its properties to the ElementTraversal pure interface and used it on {{domxref("Element")}}. |
{{Compat("api.ParentNode")}}