parentElement property

Element? get parentElement
inherited

The Node.parentElement read-only property returns the DOM node's parent Element, or null if the node either has no parent, or its parent isn't a DOM Element.

Implementation

Element? get parentElement {
  if (parentNode != null && parentNode!.nodeType == NodeType.ELEMENT_NODE) {
    return parentNode as Element;
  }
  return null;
}