Skip to content

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

Merged
thetutlage merged 2 commits intodimerapp:developfrom
7nohe:fix/link-hash
Sep 3, 2024
Merged

fix: update querySelector to use decodeURIComponent for link hash#1
thetutlage merged 2 commits intodimerapp:developfrom
7nohe:fix/link-hash

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