-
Notifications
You must be signed in to change notification settings - Fork 71
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
"Failed to execute 'querySelectorAll'" when selector contains special characters #492
Comments
Hi @triskweline! I'm having the same problem with Tailwind CSS. Is a new patch release coming soon by any chance? |
The fix has been released as part of version 3.2.1. |
@triskweline I've stumbled upon this bug again, for Unpoly 3.7.3. In this case, it isn't Tailwind's JIT syntax, but just this variant class:
It appears the problem is that it starts with a number - if for example it is just |
Would you mind opening up a new issue with a repo? That way we don't lose track of it. |
I've been unable to reproduce it in an isolated environment, so I suspect we might have a markup issue that is interfering with the query selector. If I'm able to reproduce consistently, I'll open up a new ticket |
Bug description
We use Tailwind for our projects, and we also leverage it's JIT feature for composing some dynamic classes on the fly, e.g.
text-[1.2rem]
,!font-bold
, etc. Note that this introduces some special characters in the mix such as brackets, exclamation points, periods (which aren't a class selector) etc.After upgrading from Unpoly 2.7.2 to 3.1.1 (with no other changes to markup), we are getting JS errors when clicking on a link that Unpoly handles, when that link contains classes with at least one of these special characters. For example given this markup:
We see this error:
With the following stack trace:
That top trace points to line 6783 of the unminified version, .e.g https://www.npmjs.com/package/unpoly:
As you can see, the
selector
string value is a concatenated list of classes on the link element, but none of the classes themselves are escaped.As in, I can get the querySelectorAll to work if I escape each of the classes like so:
Reproduction project
Unfortunately I have not been able to replicate this in isolation. I have tried: https://able-icy-sunday.glitch.me/
But if you wanted to reach out to me privately I can invite you to a staging environment for our client project where this can be demonstrated.
The only other difference that may be worth mentioning is that we are integrating Unpoly via npm, we are importing and bundling Unpoly with our app JS, rather than linking to an external version as with Glitch.
The text was updated successfully, but these errors were encountered: