mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-22 07:05:24 +00:00
Merge pull request #561 from thgh/patch-3
Use getElementById to avoid querySelector error
This commit is contained in:
@@ -158,7 +158,7 @@ export async function navigate(target: Target, id: number, noscroll?: boolean, h
|
|||||||
|
|
||||||
if (hash) {
|
if (hash) {
|
||||||
// scroll is an element id (from a hash), we need to compute y.
|
// scroll is an element id (from a hash), we need to compute y.
|
||||||
const deep_linked = document.querySelector(hash);
|
const deep_linked = document.getElementById(hash.slice(1));
|
||||||
|
|
||||||
if (deep_linked) {
|
if (deep_linked) {
|
||||||
scroll = {
|
scroll = {
|
||||||
@@ -338,4 +338,4 @@ export function load_component(component: ComponentLoader): Promise<{
|
|||||||
|
|
||||||
function detach(node: Node) {
|
function detach(node: Node) {
|
||||||
node.parentNode.removeChild(node);
|
node.parentNode.removeChild(node);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user