thisOrAncestorMatching<E extends Element> method
- @Deprecated('Use Element2.thisOrAncestorMatching2() instead')
- @override
- bool predicate(
- Element
inherited
Returns either this element or the most immediate ancestor of this element
for which the predicate
returns true
, or null
if there is no such
element.
Implementation
@Deprecated('Use Element2.thisOrAncestorMatching2() instead')
@override
E? thisOrAncestorMatching<E extends Element>(
bool Function(Element) predicate,
) {
Element? element = this;
while (element != null && !predicate(element)) {
element = element.enclosingElement3;
}
return element as E?;
}