Skip to content

Commit

Permalink
js: Don't adjust style by using element.cssText
Browse files Browse the repository at this point in the history
That's prohibited if using `script-src 'self';` in the csp header
  • Loading branch information
nilmerg committed Feb 2, 2024
1 parent 0258676 commit 2f2d54e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public/js/icinga/behavior/collapsible.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@
if (this.isDetails(collapsible)) {
collapsible.open = false;
} else {
collapsible.style.cssText = 'display: block; height: ' + toHeight + 'px; padding-bottom: 0';
collapsible.style.display = 'block';
collapsible.style.height = toHeight + 'px';
collapsible.style.paddingBottom = '0px';

if ('hasExternalToggle' in collapsible.dataset) {
document.getElementById(collapsible.dataset.toggleElement).classList.add('collapsed');
Expand All @@ -445,7 +447,9 @@
if (this.isDetails(collapsible)) {
collapsible.open = true;
} else {
collapsible.style.cssText = '';
collapsible.style.display = '';
collapsible.style.height = '';
collapsible.style.paddingBottom = '';

if ('hasExternalToggle' in collapsible.dataset) {
document.getElementById(collapsible.dataset.toggleElement).classList.remove('collapsed');
Expand Down

0 comments on commit 2f2d54e

Please sign in to comment.