From d26269865f633e36ab1eb1280550cbcc70dd8a4d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Feb 2021 07:43:05 +0300 Subject: [PATCH] use .closest() instead of .up() to lookup parent by selector --- js/Article.js | 2 +- js/Headlines.js | 2 +- js/common.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/Article.js b/js/Article.js index b1d14c390..90be90f7b 100644 --- a/js/Article.js +++ b/js/Article.js @@ -63,7 +63,7 @@ const Article = { } }, setScore: function (id, pic) { - const row = pic.up("div[id*=RROW]"); + const row = pic.closest("div[id*=RROW]"); if (row) { const score_old = row.getAttribute("data-score"); diff --git a/js/Headlines.js b/js/Headlines.js index 143a42d0b..34dc9385e 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -1093,7 +1093,7 @@ const Headlines = { return rv; }, onRowChecked: function (elem) { - const row = elem.domNode.up("div[id*=RROW]"); + const row = elem.domNode.closest("div[id*=RROW]"); // do not allow unchecking active article checkbox if (row.hasClassName("active")) { diff --git a/js/common.js b/js/common.js index a5e1e503a..f96ac8da4 100755 --- a/js/common.js +++ b/js/common.js @@ -164,7 +164,7 @@ const Lists = { // account for dojo checkboxes elem = elem.domNode || elem; - const row = elem.up("li"); + const row = elem.closest("li"); if (row) checked ? row.addClassName("Selected") : row.removeClassName("Selected"); @@ -194,7 +194,7 @@ const Tables = { const checked = elem.domNode ? elem.attr("checked") : elem.checked; elem = elem.domNode || elem; - const row = elem.up("tr"); + const row = elem.closest("tr"); if (row) checked ? row.addClassName("Selected") : row.removeClassName("Selected");