Skip to content

Commit

Permalink
Fix some small linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mna committed Oct 26, 2021
1 parent 4110e17 commit b6dc0bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bench_property_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ func BenchmarkHtml(b *testing.B) {
sel := DocW().Find("h2")
b.StartTimer()
for i := 0; i < b.N; i++ {
sel.Html()
_, _ = sel.Html()
}
}
7 changes: 4 additions & 3 deletions utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ func nodeName(node *html.Node) string {
case html.ElementNode, html.DoctypeNode:
return node.Data
default:
if node.Type >= 0 && int(node.Type) < len(nodeNames) {
if int(node.Type) < len(nodeNames) {
return nodeNames[node.Type]
}
return ""
}
}

// Render renders the html of the first element from selector and writes it to the writer.
// // It behaves the same as OuterHtml but writes to w instead of returning the string.
// Render renders the html of the first element from selector and writes it to
// the writer. It behaves the same as OuterHtml but writes to w instead of
// returning the string.
func Render(w io.Writer, s *Selection) error {
if s.Length() == 0 {
return nil
Expand Down
1 change: 1 addition & 0 deletions utilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func TestNodeNameMultiSel(t *testing.T) {
t.Errorf("want %v, got %v", in, out)
}
}

func TestOuterHtml(t *testing.T) {
doc, err := NewDocumentFromReader(strings.NewReader(allNodes))
if err != nil {
Expand Down

0 comments on commit b6dc0bd

Please sign in to comment.