Skip to content

Commit a7e98d7

Browse files
authored
Fix the show/hide methods for string selector (#23042)
At that moment I made a mistake (failed to detect a JS variable type correctly) Close #23040
1 parent 09d7377 commit a7e98d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

web_src/js/utils/dom.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function assertShown(el, expectShown) {
1919
}
2020

2121
function elementsCall(el, func, ...args) {
22-
if (el instanceof String) {
22+
if (typeof el === 'string' || el instanceof String) {
2323
el = document.querySelectorAll(el);
2424
}
2525
if (el instanceof Node) {
@@ -34,6 +34,10 @@ function elementsCall(el, func, ...args) {
3434
}
3535
}
3636

37+
/**
38+
* @param el string (selector), Node, NodeList, HTMLCollection, Array or jQuery
39+
* @param force force=true to show or force=false to hide, undefined to toggle
40+
*/
3741
function toggleShown(el, force) {
3842
if (force === true) {
3943
el.classList.remove('gt-hidden');

0 commit comments

Comments
 (0)