p1: /v2/scrape, /v1/fetch, auth, CLI, contract tests
Single Fetcher.Fetch on the Guard that holds DenyPrefixes. skipTlsVerification is ignored. No 502. keys add writes the secret only to --out. Release binary has no -test-allow-prefix.
This commit is contained in:
Generated
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
package domutils
|
||||
|
||||
import (
|
||||
"github.com/JohannesKaufmann/dom"
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
func RemoveRedundant(doc *html.Node, matchFn func(*html.Node, *html.Node) bool) {
|
||||
for _, node := range dom.AllNodes(doc) {
|
||||
if hasSameTypeAncestor(node, matchFn) {
|
||||
dom.UnwrapNode(node)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func hasSameTypeAncestor(n *html.Node, matchFn func(*html.Node, *html.Node) bool) bool {
|
||||
if !matchFn(n, n) {
|
||||
return false
|
||||
}
|
||||
|
||||
for p := n.Parent; p != nil; p = p.Parent {
|
||||
if matchFn(n, p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user