-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Not working with identifiers starting with a digit. #532
Comments
@rigor789 the solution would be to use document.querySelector('#' + CSS.escape('999-id-with-special-characters')) |
@hacknug I'm open to adding that - but definitely need to check for |
@rigor789 sure! Will take a look on Monday. Keep in mind we will most likely need to use a polyfill or something to make it work on node. Do we have tests to ensure nothing breaks after the changes? |
Hello there.
Got this error when trying to scroll to an anchor with an ID starting with a digit :
Notes : IDs are generated with rehype slug, using github-slugger
ID with a digit first are valid spec int HTML, but not a valid CSS Selector. Could be possible to failsafe that without changing slug generation policy though.
Some insights :
https://stackoverflow.com/questions/20306204/using-queryselector-with-ids-that-are-numbers
https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape
document.querySelector("[id='1']")
The text was updated successfully, but these errors were encountered: