attributeIncludesSelector returns a Selector that matches elements where the attribute named key is a whitespace-separated list that includes val.
(key, val string)
| 189 | // attributeIncludesSelector returns a Selector that matches elements where |
| 190 | // the attribute named key is a whitespace-separated list that includes val. |
| 191 | func 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. |
no test coverage detected
searching dependent graphs…