[backport]: backport applyElemsCallback

Lifted out from 19832265814430e17b456cabd207f447c003d59a.

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 el string (selector), Node, NodeList, HTMLCollection, Array or jQuery
* @param force force=true to show or force=false to hide, undefined to toggle * @param force force=true to show or force=false to hide, undefined to toggle