Skip to content

Commit

Permalink
Update regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
asamuzaK committed Oct 2, 2024
1 parent b575584 commit f291186
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/js/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
CLASS_SELECTOR, DUO, HEX, HYPHEN, ID_SELECTOR, KEY_LOGICAL, NTH,
PS_CLASS_SELECTOR, PS_ELEMENT_SELECTOR, SELECTOR, SYNTAX_ERR, TYPE_SELECTOR
} from './constant.js';
const REG_EMPTY_PS_FUNC = /(?<=:(?:dir|has|host(?:-context)?|is|lang|not|nth-(?:last-)?(?:child|of-type)|where)\()\s+\)/g;
const REG_EMPTY_PS_FUNC = /(?<=:(?:dir|has|host(?:-context)?|is|lang|not|nth-(?:last-)?(?:child|of-type)|where))\(\s+\)/g;
const REG_SHADOW_PS_ELEMENT = /^part|slotted$/;
const U_FFFD = '\uFFFD';

Expand Down Expand Up @@ -156,7 +156,7 @@ export const parseSelector = selector => {
} else if (message === '")" is expected') {
// workaround for https://github.com/csstree/csstree/issues/283
if (REG_EMPTY_PS_FUNC.test(selector)) {
res = parseSelector(`${selector.replaceAll(REG_EMPTY_PS_FUNC, ')')}`);
res = parseSelector(`${selector.replaceAll(REG_EMPTY_PS_FUNC, '()')}`);
} else if (!selector.endsWith(')')) {
res = parseSelector(`${selector})`);
} else {
Expand Down

0 comments on commit f291186

Please sign in to comment.