matchesWithAncestors 方法
- String selectors
检查该元素或其任意父元素是否匹配 CSS 选择器。
实现
bool matchesWithAncestors(String selectors) {
var elem = this as Element?;
do {
if (elem!.matches(selectors)) return true;
elem = elem.parent;
} while (elem != null);
return false;
}