You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hash from an anchor is passed directly to root.querySelector with our regard for what might be contained in the hash.
Hash-routing libraries store the route in the hash. For example an anchor tag may have #!/foo/bar as the value for the href.
Passing this value to root.querySelector causes an error, for example SyntaxError: The string did not match the expected pattern. in safari or Uncaught DOMException: Document.querySelector: '#!/foo' is not a valid selector in FIrefox.
This could be solved in two ways:
a simple try/catch
further expand the regex to allow for detecting a valid query selector string before passing it to querySelector
@wessberg if you have a preference between the two approaches (or have an alternative suggestion) I am happy to open a PR that fixes the bad assumption around what can live in a hash.
The text was updated successfully, but these errors were encountered:
chrishoage
added a commit
to chrishoage/scroll-behavior-polyfill
that referenced
this issue
Jun 16, 2021
scroll-behavior-polyfill/src/patch/anchor/catch-navigation.ts
Lines 33 to 34 in 0e4973c
hash
from an anchor is passed directly toroot.querySelector
with our regard for what might be contained in the hash.Hash-routing libraries store the route in the hash. For example an anchor tag may have
#!/foo/bar
as the value for the href.Passing this value to
root.querySelector
causes an error, for exampleSyntaxError: The string did not match the expected pattern.
in safari orUncaught DOMException: Document.querySelector: '#!/foo' is not a valid selector
in FIrefox.This could be solved in two ways:
querySelector
@wessberg if you have a preference between the two approaches (or have an alternative suggestion) I am happy to open a PR that fixes the bad assumption around what can live in a hash.
The text was updated successfully, but these errors were encountered: