visitAncestorElements method
Walk up the element tree calling visitor for each ancestor until it
returns false or the root is reached.
Implementation
void visitAncestorElements(bool Function(Element element) visitor) {
var ancestor = parent;
while (ancestor != null && visitor(ancestor)) {
ancestor = ancestor.parent;
}
}