withAncestors property

Iterable<Element> get withAncestors

Return this element and all its enclosing elements.

Implementation

Iterable<Element> get withAncestors sync* {
  var current = this;
  while (true) {
    yield current;
    final enclosing = current.enclosingElement;
    if (enclosing == null) {
      break;
    }
    current = enclosing;
  }
}