Skip to content

Commit 4268847

Browse files
committed
ExampleParse: Use atom.A
1 parent e8797ff commit 4268847

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

html/example_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414

1515
"golang.org/x/net/html"
16+
"golang.org/x/net/html/atom"
1617
)
1718

1819
func ExampleParse() {
@@ -22,7 +23,7 @@ func ExampleParse() {
2223
log.Fatal(err)
2324
}
2425
for n := range doc.All() {
25-
if n.Type == html.ElementNode && n.Data == "a" {
26+
if n.Type == html.ElementNode && n.DataAtom == atom.A {
2627
for _, a := range n.Attr {
2728
if a.Key == "href" {
2829
fmt.Println(a.Val)

0 commit comments

Comments
 (0)