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
pull/23043/head^2
wxiaoguang 2 years ago committed by GitHub
parent 09d7377090
commit a7e98d70b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      web_src/js/utils/dom.js

@ -19,7 +19,7 @@ function assertShown(el, expectShown) {
}
function elementsCall(el, func, ...args) {
if (el instanceof String) {
if (typeof el === 'string' || el instanceof String) {
el = document.querySelectorAll(el);
}
if (el instanceof Node) {
@ -34,6 +34,10 @@ function elementsCall(el, func, ...args) {
}
}
/**
* @param el string (selector), Node, NodeList, HTMLCollection, Array or jQuery
* @param force force=true to show or force=false to hide, undefined to toggle
*/
function toggleShown(el, force) {
if (force === true) {
el.classList.remove('gt-hidden');

Loading…
Cancel
Save