Skip to content

Commit 0eb10b1

Browse files
committed
fix
1 parent dbdb5ba commit 0eb10b1

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

web_src/js/utils/dom.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
function getComputedStyleProperty(el, prop) {
2-
const cs = el ? window.getComputedStyle(el) : null;
3-
return cs ? cs[prop] : null;
4-
}
5-
6-
function isShown(el) {
7-
return getComputedStyleProperty(el, 'display') !== 'none';
8-
}
9-
10-
function assertShown(el, expectShown) {
11-
if (window.config.runModeIsProd) return;
12-
13-
// to help developers to catch display bugs, this assertion can be removed after next release cycle or if it has been proved that there is no bug.
14-
if (expectShown && !isShown(el)) {
15-
throw new Error('element is hidden but should be shown');
16-
} else if (!expectShown && isShown(el)) {
17-
throw new Error('element is shown but should be hidden');
18-
}
19-
}
20-
211
function elementsCall(el, func, ...args) {
222
if (typeof el === 'string' || el instanceof String) {
233
el = document.querySelectorAll(el);
@@ -41,16 +21,10 @@ function elementsCall(el, func, ...args) {
4121
function toggleShown(el, force) {
4222
if (force === true) {
4323
el.classList.remove('gt-hidden');
44-
assertShown(el, true);
4524
} else if (force === false) {
4625
el.classList.add('gt-hidden');
47-
assertShown(el, false);
4826
} else if (force === undefined) {
49-
const wasShown = window.config.runModeIsProd ? undefined : isShown(el);
5027
el.classList.toggle('gt-hidden');
51-
if (wasShown !== undefined) {
52-
assertShown(el, !wasShown);
53-
}
5428
} else {
5529
throw new Error('invalid force argument');
5630
}

0 commit comments

Comments
 (0)