From 27e414646149876f71865622f0d5d5118231d0f7 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 31 Jul 2019 07:55:15 +0200 Subject: luci-base: luci.js: add L.dom.isEmpty() helper Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/luci.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/luci-base') 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; } }), -- cgit v1.2.3