If the value passed to getAttrValueMatch is quoted, then remove the
quotes.
Showing
1 changed file
with
1 additions
and
0 deletions
| ... | @@ -98,6 +98,7 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => { | ... | @@ -98,6 +98,7 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => { |
| 98 | 98 | ||
| 99 | const getAttrValueMatch = (value: string, operator: string = '=', caseSensitive: boolean): AttrValueMatch => { | 99 | const getAttrValueMatch = (value: string, operator: string = '=', caseSensitive: boolean): AttrValueMatch => { |
| 100 | if (value === undefined) return (attrValue) => attrValue !== undefined | 100 | if (value === undefined) return (attrValue) => attrValue !== undefined |
| 101 | if (value[ 0 ] === '"' || value[ 0 ] === '\'') value = value.substring(1, value.length - 1) | ||
| 101 | const isCaseInsensitive = caseSensitive === 'i' | 102 | const isCaseInsensitive = caseSensitive === 'i' |
| 102 | if (isCaseInsensitive) value = value.toLowerCase() | 103 | if (isCaseInsensitive) value = value.toLowerCase() |
| 103 | const adjustMatcher = (matcher) => isCaseInsensitive ? (attrValue) => matcher(attrValue.toLowerCase()) : matcher | 104 | const adjustMatcher = (matcher) => isCaseInsensitive ? (attrValue) => matcher(attrValue.toLowerCase()) : matcher | ... | ... |
-
Please register or sign in to post a comment