aboutsummaryrefslogtreecommitdiff
path: root/docs/articles/gmkin_manual_files/accessible-code-block-0.0.1/empty-anchor.js
blob: ca349fd6a570108bde9d7daace534cd651c5f042 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Hide empty <a> tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) -->
// v0.0.1
// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020.

document.addEventListener('DOMContentLoaded', function() {
  const codeList = document.getElementsByClassName("sourceCode");
  for (var i = 0; i < codeList.length; i++) {
    var linkList = codeList[i].getElementsByTagName('a');
    for (var j = 0; j < linkList.length; j++) {
      if (linkList[j].innerHTML === "") {
        linkList[j].setAttribute('aria-hidden', 'true');
      }
    }
  }
});

Contact - Imprint