forked from OSchip/llvm-project
[analyzer] Add support for IE of keyboard and mouse navigation in HTML report
IE throws errors while using key and mouse navigation through the error path tips. querySelectorAll method returns NodeList. NodeList belongs to browser API. IE doesn't have forEach among NodeList's methods. At the same time Array is a JavaScript object and can be used instead. The fix is in the converting NodeList into Array and keeps using forEach method as before. Checked in IE11, Chrome and Opera. Differential Revision: https://reviews.llvm.org/D80444
This commit is contained in:
parent
9f69d3d0bc
commit
6bbaa62d26
|
@ -1070,8 +1070,13 @@ StringRef HTMLDiagnostics::generateKeyboardNavigationJavascript() {
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
var digitMatcher = new RegExp("[0-9]+");
|
var digitMatcher = new RegExp("[0-9]+");
|
||||||
|
|
||||||
|
var querySelectorAllArray = function(selector) {
|
||||||
|
return Array.prototype.slice.call(
|
||||||
|
document.querySelectorAll(selector));
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
document.querySelectorAll(".PathNav > a").forEach(
|
querySelectorAllArray(".PathNav > a").forEach(
|
||||||
function(currentValue, currentIndex) {
|
function(currentValue, currentIndex) {
|
||||||
var hrefValue = currentValue.getAttribute("href");
|
var hrefValue = currentValue.getAttribute("href");
|
||||||
currentValue.onclick = function() {
|
currentValue.onclick = function() {
|
||||||
|
@ -1091,7 +1096,7 @@ var findNum = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var scrollTo = function(el) {
|
var scrollTo = function(el) {
|
||||||
document.querySelectorAll(".selected").forEach(function(s) {
|
querySelectorAllArray(".selected").forEach(function(s) {
|
||||||
s.classList.remove("selected");
|
s.classList.remove("selected");
|
||||||
});
|
});
|
||||||
el.classList.add("selected");
|
el.classList.add("selected");
|
||||||
|
|
Loading…
Reference in New Issue