MCPcopy Create free account
hub / github.com/andybalholm/cascadia / attributeIncludesSelector

Function attributeIncludesSelector

selector.go:191–206  ·  view source on GitHub ↗

attributeIncludesSelector returns a Selector that matches elements where the attribute named key is a whitespace-separated list that includes val.

(key, val string)

Source from the content-addressed store, hash-verified

189// attributeIncludesSelector returns a Selector that matches elements where
190// the attribute named key is a whitespace-separated list that includes val.
191func attributeIncludesSelector(key, val string) Selector {
192 return attributeSelector(key,
193 func(s string) bool {
194 for s != "" {
195 i := strings.IndexAny(s, " \t\r\n\f")
196 if i == -1 {
197 return s == val
198 }
199 if s[:i] == val {
200 return true
201 }
202 s = s[i+1:]
203 }
204 return false
205 })
206}
207
208// attributeDashmatchSelector returns a Selector that matches elements where
209// the attribute named key equals val or starts with val plus a hyphen.

Callers 2

parseClassSelectorMethod · 0.85

Calls 1

attributeSelectorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…