LeaVerou/parsel

Nested parenthesis is broken for `pseudo-element`s

jrandolf-2 opened this issue ยท 1 comments

Hi ๐Ÿ‘‹ , Puppeteer maintainer here.

We're interested in using parsel for selector parsing in Puppeteer. We are implementing custom functionality into selectors, but found argument parsing for pseudo-elements to be broken. The similar problem with pseudo-classes is working.

MVCE:

// Pseudo-classes: Works!
Input: ':test(a()f)'
Output: [
	{
		"type": "pseudo-class",
		"content": ":test(a()f)",
		"name": "test",
		"argument": "a()f",
		"pos": [
			0,
			11
		]
	}
]
// Pseudo-elements: Broken!
Input: '::test(a()f)'
Output: [
	{
		"type": "pseudo-element",
		"content": "::test(a()f)",
		"name": "test",
		"argument": "a(",
		"pos": [
			0,
			12
		]
	}
]

Hey, great to hear you're considering using Parcel for Puppeteer! Which part of Puppeteer, out of curiosity?

I see it was a pretty easy fix, and you've already fixed it in your fork, so I'll just wait for the PR. Thanks for looking into it!