Files
kurious/internal/common/client/sravni/helpers.go
2023-11-26 15:39:34 +03:00

21 lines
402 B
Go

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
}