| 1 | // Hide empty <a> tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> |
| 2 | // v0.0.1 |
| 3 | // Written by JooYoung Seo ([email protected]) and Atsushi Yasumoto on June 1st, 2020. |
| 4 | |
| 5 | document.addEventListener('DOMContentLoaded', function() { |
| 6 | const codeList = document.getElementsByClassName("sourceCode"); |
| 7 | for (var i = 0; i < codeList.length; i++) { |
| 8 | var linkList = codeList[i].getElementsByTagName('a'); |
| 9 | for (var j = 0; j < linkList.length; j++) { |
| 10 | if (linkList[j].innerHTML === "") { |
| 11 | linkList[j].setAttribute('aria-hidden', 'true'); |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | }); |