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

Fails when trying to scroll to element where ID contains a colon (:) #593

Open
Nickno95 opened this issue Sep 11, 2021 · 2 comments
Open

Comments

@Nickno95
Copy link

HTML5 allows elements to have IDs that contain colons, ex:

<div id="#this:isvalid"></div>

However, because this library is using document.querySelector, it is going by CSS selector rules, so a colon in the ID would need to be escaped before calling querySelector, otherwise it would fail with error:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#this:isvalid' is not a valid selector.

@tre-dev
Copy link

tre-dev commented Nov 19, 2021

Had the same error. Would be nice if that could be fixed on the plugin layer, just for others who might stumble upon the problem:

string.replace(':', '\\:') works

@hacknug
Copy link

hacknug commented Dec 10, 2021

Duplicate of #532 (only with different id characters)

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

3 participants