Skip to content

Commit

Permalink
ExampleParse: Use atom.A
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed Jun 22, 2024
1 parent e8797ff commit 4268847
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion html/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"

"golang.org/x/net/html"
"golang.org/x/net/html/atom"
)

func ExampleParse() {
Expand All @@ -22,7 +23,7 @@ func ExampleParse() {
log.Fatal(err)
}
for n := range doc.All() {
if n.Type == html.ElementNode && n.Data == "a" {
if n.Type == html.ElementNode && n.DataAtom == atom.A {
for _, a := range n.Attr {
if a.Key == "href" {
fmt.Println(a.Val)
Expand Down

0 comments on commit 4268847

Please sign in to comment.