aboutsummaryrefslogtreecommitdiff
path: root/internal/testing/htmlcheck/query.go
diff options
context:
space:
mode:
authorHana Kim <hyangah@gmail.com>2026-03-05 22:47:31 -0500
committerHyang-Ah Hana Kim <hyangah@gmail.com>2026-03-26 14:11:32 -0700
commit98258ff769bbca6f3d004ce80fabf5bff8f1136c (patch)
tree1ff3dccebdfc2df17009088688a1575383f68a42 /internal/testing/htmlcheck/query.go
parent34edebc0803b121acd1cbf363eef074e0a13ab6d (diff)
downloadgo-x-pkgsite-98258ff769bbca6f3d004ce80fabf5bff8f1136c.tar.xz
all: run go fix -slicescontains
Change-Id: I14479d9e612dfa7eed9188206746af5b51c10201 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753428 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/testing/htmlcheck/query.go')
-rw-r--r--internal/testing/htmlcheck/query.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/testing/htmlcheck/query.go b/internal/testing/htmlcheck/query.go
index 75a196dd..fe594150 100644
--- a/internal/testing/htmlcheck/query.go
+++ b/internal/testing/htmlcheck/query.go
@@ -7,6 +7,7 @@ package htmlcheck
import (
"errors"
"fmt"
+ "slices"
"strconv"
"strings"
@@ -317,10 +318,8 @@ func (s *classSelector) match(n *html.Node) bool {
}
for _, attr := range n.Attr {
if attr.Key == "class" {
- for _, f := range strings.Fields(attr.Val) {
- if f == s.class {
- return true
- }
+ if slices.Contains(strings.Fields(attr.Val), s.class) {
+ return true
}
break
}