use .closest() instead of .up() to lookup parent by selector

This commit is contained in:
Andrew Dolgov 2021-02-19 07:43:05 +03:00
parent bec35200e9
commit d26269865f
3 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ const Article = {
} }
}, },
setScore: function (id, pic) { setScore: function (id, pic) {
const row = pic.up("div[id*=RROW]"); const row = pic.closest("div[id*=RROW]");
if (row) { if (row) {
const score_old = row.getAttribute("data-score"); const score_old = row.getAttribute("data-score");

View File

@ -1093,7 +1093,7 @@ const Headlines = {
return rv; return rv;
}, },
onRowChecked: function (elem) { 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 // do not allow unchecking active article checkbox
if (row.hasClassName("active")) { if (row.hasClassName("active")) {

View File

@ -164,7 +164,7 @@ const Lists = {
// account for dojo checkboxes // account for dojo checkboxes
elem = elem.domNode || elem; elem = elem.domNode || elem;
const row = elem.up("li"); const row = elem.closest("li");
if (row) if (row)
checked ? row.addClassName("Selected") : row.removeClassName("Selected"); checked ? row.addClassName("Selected") : row.removeClassName("Selected");
@ -194,7 +194,7 @@ const Tables = {
const checked = elem.domNode ? elem.attr("checked") : elem.checked; const checked = elem.domNode ? elem.attr("checked") : elem.checked;
elem = elem.domNode || elem; elem = elem.domNode || elem;
const row = elem.up("tr"); const row = elem.closest("tr");
if (row) if (row)
checked ? row.addClassName("Selected") : row.removeClassName("Selected"); checked ? row.addClassName("Selected") : row.removeClassName("Selected");