mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03:00
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
This commit is contained in:
parent
09d7377090
commit
a7e98d70b6
1 changed files with 5 additions and 1 deletions
|
@ -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…
Reference in a new issue