bool matchesPath(List<Element> elem) { // by default, just match the leaf, but allow for more complicated // paths return matches(elem.last); }