in Readability.js [2227:2245]
_hasAncestorTag(node, tagName, maxDepth, filterFn) {
maxDepth = maxDepth || 3;
tagName = tagName.toUpperCase();
var depth = 0;
while (node.parentNode) {
if (maxDepth > 0 && depth > maxDepth) {
return false;
}
if (
node.parentNode.tagName === tagName &&
(!filterFn || filterFn(node.parentNode))
) {
return true;
}
node = node.parentNode;
depth++;
}
return false;
},