luci-base: luci.js: support custom filter function in dom.isEmpty()
authorJo-Philipp Wich <jo@mein.io>
Tue, 20 Aug 2019 11:31:07 +0000 (13:31 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 10 Sep 2019 13:28:16 +0000 (15:28 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/luci.js

index d72764b11449be885466bba6a438406ef3881932..582e3730094c70fcd2d8fe23f153de135c295b6c 100644 (file)
                                return inst[method].apply(inst, inst.varargs(arguments, 2));
                        },
 
-                       isEmpty: function(node) {
+                       isEmpty: function(node, ignoreFn) {
                                for (var child = node.firstElementChild; child != null; child = child.nextElementSibling)
-                                       if (!child.classList.contains('hidden'))
+                                       if (!child.classList.contains('hidden') && (!ignoreFn || !ignoreFn(child)))
                                                return false;
 
                                return true;