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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export function init(_target: Node, _routes: Route[]) {
setTimeout(() => {
const { hash, href } = window.location;

const deep_linked = hash && document.querySelector(hash);
const deep_linked = hash && document.getElementById(hash.slice(1));
scroll_history[uid] = deep_linked ?
{ x: 0, y: deep_linked.getBoundingClientRect().top } :
scroll_state();
Expand Down