From ae5aac353425e83e71b911c2574f0cfefda6417f Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Mon, 28 Jun 2021 10:30:03 +0700 Subject: [PATCH] stricter regex pattern --- src/compiler/compile/css/Selector.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts index f255e5506a..26660320a9 100644 --- a/src/compiler/compile/css/Selector.ts +++ b/src/compiler/compile/css/Selector.ts @@ -147,8 +147,7 @@ export default class Selector { for (const block of this.blocks) { for (const selector of block.selectors) { if (selector.type === 'PseudoClassSelector' && selector.name === 'global') { - const match = selector.children[0].value.match(/\(.*?\)|([^\\],)/); - if (match && match[1]) { + if (/[^\\],(?![^([]+(?:\)|\]))/.test(selector.children[0].value)) { component.error(selector, { code: 'css-invalid-global-selector', message: ':global(...) must contain a single selector'