Skip to content

Commit

Permalink
Fix: Error in HTML formatter script
Browse files Browse the repository at this point in the history
Close #1448
  • Loading branch information
sarvaje authored and alrra committed Oct 25, 2018
1 parent a0ae1c3 commit a402a07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions packages/formatter-html/src/assets/js/scan/scanner-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
var expanded = typeof closeAll !== 'undefined' ? closeAll : childRulesExpanded(element);

if (expanded) {
element.innerHTML = 'close all';
element.textContent = 'close all';
element.classList.remove('closed');
element.classList.add('expanded');
} else {
element.innerHTML = 'expand all';
element.textContent = 'expand all';
element.classList.remove('expanded');
element.classList.add('closed');
}
Expand Down Expand Up @@ -207,7 +207,6 @@

if (container) {
container.addEventListener('click', onContainerClick, false);
container.addEventListener('toggle', toggleExpand, false);
}
};

Expand Down Expand Up @@ -341,11 +340,18 @@

var contractDetails = function () {
var elements = Array.prototype.slice.apply(document.querySelectorAll('details[open]'));
var expandAllButtons = Array.prototype.slice.apply(document.querySelectorAll('.button-expand-all'));

elements.forEach(function (element) {
element.removeAttribute('open');
element.setAttribute('aria-expanded', 'false');
});

expandAllButtons.forEach(function (element) {
element.textContent = 'expand all';
element.classList.add('closed');
element.classList.remove('expanded');
});
};

var scrollToLink = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<button title="expand" class="button-expand-all closed">expand all</button>
<button title="expand" class="button-expand-all expanded">close all</button>

0 comments on commit a402a07

Please sign in to comment.