Skip to content

Commit

Permalink
also handle document.getElementsByName
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Jun 7, 2024
1 parent be3794c commit 16516c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web_src/js/markup/anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function scrollToAnchor(encodedId) {

// check for matching user-generated `a[name]`
if (!el) {
const nameAnchors = document.getElementsByName(prefixedId);
if (nameAnchors.length) {
el = nameAnchors[0];
const nameAnchor = document.querySelector(`[name="${CSS.escape(prefixedId)}"]`);
if (nameAnchor) {
el = nameAnchor;
}
}

Expand Down

0 comments on commit 16516c5

Please sign in to comment.