luci-base: luci.js: add L.dom.isEmpty() helper
authorJo-Philipp Wich <jo@mein.io>
Wed, 31 Jul 2019 05:55:15 +0000 (07:55 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 1 Aug 2019 14:47:19 +0000 (16:47 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/luci.js

index 259679f137ee452a3f6ce8ddf123004cc974b008..66f32d72237d68abec63e76a692efafae31b63c1 100644 (file)
                                        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;
                        }
                }),