diff --git a/src/pkg/html/doc.go b/src/pkg/html/doc.go
index 0620679bd64..1bea690c2c8 100644
--- a/src/pkg/html/doc.go
+++ b/src/pkg/html/doc.go
@@ -61,7 +61,7 @@ call to Next. For example, to extract an HTML page's anchor text:
case StartTagToken, EndTagToken:
tn, _ := z.TagName()
if len(tn) == 1 && tn[0] == 'a' {
- if tt == StartTag {
+ if tt == StartTagToken {
depth++
} else {
depth--