Source File
htmlcheck.go
Belonging Package
golang.org/x/pkgsite/internal/testing/htmlcheck
package htmlcheck
import (
)
func ( string, ...Checker) Checker {
:= mustParseSelector()
return func( *html.Node) error {
:= allMatching(, )
for , := range {
if := check(, ); != nil {
return fmt.Errorf("%s, #%d: %v", , , )
}
}
return nil
}
}
func ( *html.Node, cascadia.Sel) []*html.Node {
var []*html.Node
if .Match() {
= append(, )
}
return append(, cascadia.QueryAll(, )...)
}
func ( *html.Node, *strings.Builder) {
if == nil {
return
}
switch .Type {
case html.TextNode:
.WriteString(.Data)
case html.ElementNode, html.DocumentNode:
for := .FirstChild; != nil; = .NextSibling {
(, )
}
}
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |