From: Jo-Philipp Wich Date: Wed, 31 Jul 2019 05:55:15 +0000 (+0200) Subject: luci-base: luci.js: add L.dom.isEmpty() helper X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=27e414646149876f71865622f0d5d5118231d0f7;p=project%2Fluci.git luci-base: luci.js: add L.dom.isEmpty() helper Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 259679f137..66f32d7223 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1188,6 +1188,14 @@ return null; return inst[method].apply(inst, inst.varargs(arguments, 2)); + }, + + isEmpty: function(node) { + for (var child = node.firstElementChild; child != null; child = child.nextElementSibling) + if (!child.classList.contains('hidden')) + return false; + + return true; } }),