Skip to content

Commit

Permalink
Merge pull request #45 from megapctr/patch-1
Browse files Browse the repository at this point in the history
Improve the documentation for `Query`
  • Loading branch information
zhengchun committed Aug 21, 2021
2 parents 58a32db + 564855d commit bcff0c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ func QueryAll(top *html.Node, expr string) ([]*html.Node, error) {
return nodes, nil
}

// Query searches the html.Node that matches by the specified XPath expr,
// and return the first element of matched html.Node.
// Query runs the given XPath expression against the given html.Node and
// returns the first matching html.Node, or nil if no matches are found.
//
// Return an error if the expression `expr` cannot be parsed.
// Returns an error if the expression `expr` cannot be parsed.
func Query(top *html.Node, expr string) (*html.Node, error) {
exp, err := getQuery(expr)
if err != nil {
Expand Down

0 comments on commit bcff0c3

Please sign in to comment.