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

Blank className error #65

Open
HenryDavies opened this issue Oct 13, 2020 · 0 comments
Open

Blank className error #65

HenryDavies opened this issue Oct 13, 2020 · 0 comments

Comments

@HenryDavies
Copy link

Whitespace-only classNames (e.g. class=" ") are currently added with the pattern ".", causing the following error:

Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '.' is not a valid selector.

Here's the relevant bit of code in match.js:

if (attributeName === 'class') {
  const className = attributeValue.trim().replace(/\s+/g, '.')
  pattern = `.${className}`
}

I see a few potential fixes:

  • Still using the blank class as a selector, just keeping it as [class=' '] instead of converting to dot version
  • Not using it as a selector - continuing to next attribute
  • Only using as a selector if there are no non-blank attributes to use

Happy to put a fix in if helpful, just not sure which is best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant