Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-25 19:26:09 +01:00

[backport]: backport applyElemsCallback

Lifted out from 1983226581.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2024-05-14 08:39:59 +02:00
parent cbdf32126f
commit 50ac410e35
No known key found for this signature in database

View file

@ -16,6 +16,15 @@ function elementsCall(el, func, ...args) {
}
}
function applyElemsCallback(elems, fn) {
if (fn) {
for (const el of elems) {
fn(el);
}
}
return elems;
}
/**
* @param el string (selector), Node, NodeList, HTMLCollection, Array or jQuery
* @param force force=true to show or force=false to hide, undefined to toggle