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

fix: update querySelector to use decodeURIComponent for link hash #1

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

7nohe
Copy link
Contributor

@7nohe 7nohe commented Sep 2, 2024

Problem

If the hash link contains a non-English character string, the following error occurs.

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document': '#%E3%82%B9%E3%83%9D%E3%83%B3%E3%82%B5%E3%83%BC' is not a valid selector.

Reproduction

Repository: https://github.com/7nohe/adonisjs-v6-docs-ja
Website: https://adonisjs-docs-ja.vercel.app

Solution

Decode the hash link before passing it to querySelector.

@7nohe 7nohe changed the title fix: update querySelector to use encodeURIComponent for link hash fix: update querySelector to use decodeURIComponent for link hash Sep 2, 2024
@thetutlage thetutlage merged commit 07faea6 into dimerapp:develop Sep 3, 2024
@7nohe 7nohe deleted the fix/link-hash branch September 3, 2024 03:39
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

Successfully merging this pull request may close these issues.

2 participants