Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Fix DOMException when location.hash is invalid selector #104

Merged
merged 1 commit into from
Feb 3, 2018

Conversation

thgh
Copy link
Contributor

@thgh thgh commented Jan 26, 2018

While building an app that uses location.hash extensively, the following error occurred often:
Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#' is not a valid selector.

querySelector throws on invalid selectors, but getElementById doesn't throw on invalid ids.

@Rich-Harris Rich-Harris merged commit b53ee06 into sveltejs:restructure Feb 3, 2018
@Rich-Harris
Copy link
Member

thank you! wasn't aware of this, nice fix

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

Successfully merging this pull request may close these issues.

2 participants