From 6b8fc99fd5897d9a0d959d567a02113ef5b2a328 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 20 Oct 2018 09:55:59 +0200 Subject: [PATCH] luci-base: cbi.js: utilize node.closest() if available Use node.closest() in findParent() when available since it should be faster than manaually traversing the ancestor chain. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index f4b0ba349..7248c5177 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -1606,6 +1606,9 @@ function matchesElem(node, selector) function findParent(node, selector) { + if (node.closest) + return node.closest(selector); + while (node) if (matchesElem(node, selector)) return node; -- 2.25.1