attributeSubstringMatch matches nodes where the attribute named key contains val.
(key, val string, n *html.Node, ignoreCase bool)
| 398 | // attributeSubstringMatch matches nodes where |
| 399 | // the attribute named key contains val. |
| 400 | func attributeSubstringMatch(key, val string, n *html.Node, ignoreCase bool) bool { |
| 401 | return matchAttribute(n, key, |
| 402 | func(s string) bool { |
| 403 | if strings.TrimSpace(s) == "" { |
| 404 | return false |
| 405 | } |
| 406 | if ignoreCase { |
| 407 | return strings.Contains(strings.ToLower(s), strings.ToLower(val)) |
| 408 | } |
| 409 | return strings.Contains(s, val) |
| 410 | }) |
| 411 | } |
| 412 | |
| 413 | // attributeRegexMatch matches nodes where |
| 414 | // the attribute named key matches the regular expression rx |