diff --git a/packages/shared-common/src/index.ts b/packages/shared-common/src/index.ts index 8528916230..32e4633e4c 100644 --- a/packages/shared-common/src/index.ts +++ b/packages/shared-common/src/index.ts @@ -1,5 +1,5 @@ import type { UnoGenerator } from '@unocss/core' -import { e, isAttributifySelector, regexClassGroup } from '@unocss/core' +import { isAttributifySelector, regexClassGroup } from '@unocss/core' import MagicString from 'magic-string' // https://github.com/dsblv/string-replace-async/blob/main/index.js @@ -78,7 +78,7 @@ export function getMatchedPositions(code: string, matched: string[], hasVariantG // attributify values attributify.forEach(([, name, value]) => { - const regex = new RegExp(`(${e(name)}=)(['"])[^\\2]*?${e(value)}[^\\2]*?\\2`, 'g') + const regex = new RegExp(`(${name}=)(['"])[^\\2]*?${value}[^\\2]*?\\2`, 'g') Array.from(code.matchAll(regex)) .forEach((match) => { const escaped = match[1] diff --git a/test/pos.test.ts b/test/pos.test.ts index e45856d849..aa51fc597b 100644 --- a/test/pos.test.ts +++ b/test/pos.test.ts @@ -15,7 +15,7 @@ describe('matched-positions', async () => { ], }) - expect(await match(uno, '
')) + expect(await match(uno, '
')) .toMatchInlineSnapshot(` [ [ @@ -28,6 +28,11 @@ describe('matched-positions', async () => { 20, "[border=\\"gray4\\"]", ], + [ + 21, + 22, + "[border=\\"2\\"]", + ], ] `) })