Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaped ( in selectors breaks output #30

Closed
guivr opened this issue May 15, 2022 · 2 comments · Fixed by #57
Closed

Escaped ( in selectors breaks output #30

guivr opened this issue May 15, 2022 · 2 comments · Fixed by #57
Labels
bug Something isn't working

Comments

@guivr
Copy link

guivr commented May 15, 2022

Hi! Thank you so much for this.

I found a bug when using Tailwind.

Selector:
.mb-\[max\(-70\%\2c -23rem\)\]

returns token:

[
	{
		"type": "class",
		"content": ".mb-\\[max\\(¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶",
		"name": "mb-\\[max\\(¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶",
		"pos": [
			0,
			27
		]
	},
	")\\]"
]
@jrandolf-2
Copy link
Collaborator

jrandolf-2 commented Mar 6, 2023

This selector isn't a proper CSS selector to begin with, but Parsel should at least throw or handle this case gracefully.

@LeaVerou LeaVerou changed the title Selector breaking ¶¶¶¶¶¶¶ Escaped ( in selectors breaks output Mar 6, 2023
@LeaVerou
Copy link
Owner

LeaVerou commented Mar 6, 2023

The root cause of the bug is the escaped parens, in fact even a selector like .\(\) reproduces the issue, and .\( causes an actual error (Opening paren without closing paren), which makes me think they are somehow interpreted literally in the regexes.

This is definitely a bug, thanks for catching it!

@jrandolf Special characters can totally be a part of class or attribute names, they just need escaping.

@LeaVerou LeaVerou added the bug Something isn't working label Mar 6, 2023
jrandolf-2 pushed a commit that referenced this issue Mar 14, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
jrandolf-2 pushed a commit that referenced this issue Mar 15, 2023
This fixes an problem related to parsing CSS escapes and removes some redundant matching done during restoration of strings and parentheses.

Fixed: #30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants