package sravni
import "golang.org/x/net/html"
func findNode(parent *html.Node, eq func(*html.Node) (found, deeper bool)) *html.Node {
for child := parent.FirstChild; child != nil; child = child.NextSibling {
found, deeper := eq(child)
if found {
return child
}
if deeper {
deeperChild := findNode(child, eq)
if deeperChild != nil {
return deeperChild
}
}
}
return nil
}