diff --git a/waitForKeyElements.js b/waitForKeyElements.js index f144eda..3ab2580 100644 --- a/waitForKeyElements.js +++ b/waitForKeyElements.js @@ -31,7 +31,14 @@ function waitForKeyElements( search. */ ) { - let targetNodes, btargetsFound; + /** + * @typedef targetNodes + * @type {Array} + */ + + /** @type {targetNodes} */ + let targetNodes; + let btargetsFound; if (typeof iframeSelector == "undefined") targetNodes = document.querySelector(selectorTxt); @@ -43,7 +50,7 @@ function waitForKeyElements( /*--- Found target node(s). Go through each and act if they are new. */ - targetNodes.each(function () { + targetNodes.forEach(function () { let jThis = this; let alreadyFound = jThis.data("alreadyFound") || false;