Skip to content

Commit

Permalink
* xover.listener.on(['pageshow', 'popstate'] - refactored querySelect…
Browse files Browse the repository at this point in the history
…or to be more resilient
  • Loading branch information
uriel-online committed Jul 8, 2024
1 parent f6aebcf commit b4539a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1426,9 +1426,9 @@ xover.listener.on(['pageshow', 'popstate'], async function (event) {
await xover.ready;
event.type == 'popstate' && document.querySelectorAll(`[role=alertdialog],dialog`).toArray().remove();
if (history.state) delete history.state.active;
let hash = top.location.hash;
let hash = top.location.hash || '#';
hash = hash.split(/\?/)[0];
if (hash && !document.querySelector(hash)) {
if (hash && !document.querySelector(`[id="${hash.split(/^#/)[1]}"]`)) {
xover.site.seed = (history.state || {}).seed || hash || '#';
}
xover.waitFor(location.hash || document.firstElementChild, 10000).then(target => target.dispatch('scrollIntoView'));
Expand Down

0 comments on commit b4539a8

Please sign in to comment.