a09fbb8e by Adam Heath

Use regex when looking for attribute values with quotes.

1 parent 458e87da
......@@ -114,7 +114,7 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => {
const getAttrValueMatch = (value: string, operator: string = '=', caseSensitive: boolean): AttrValueMatch => {
if (value === undefined) return (attrValue) => attrValue !== undefined
if (value[ 0 ] === '"' || value[ 0 ] === '\'') value = value.substring(1, value.length - 1)
if (value.match(/^(['"]).*\1$/)) value = value.substring(1, value.length - 1)
const isCaseInsensitive = caseSensitive === 'i'
if (isCaseInsensitive) value = value.toLowerCase()
const adjustMatcher = (matcher) => isCaseInsensitive ? (attrValue) => matcher(attrValue.toLowerCase()) : matcher
......