Fix the visual marking of the markAll checkbox for Controller/Clipboard.ts
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 16 Feb 2021 15:26:35 +0000 (16:26 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 16 Feb 2021 15:27:39 +0000 (16:27 +0100)
During the refactoring to TypeScript it was missed that after matching the
`.columnMark` class another access to `.parentNode` happens:

https://github.com/WoltLab/WCF/blob/6a623551e6d7a08ffdf7a623aa174e644af7a0d5/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Clipboard.js#L691

Fixes #3999

ts/WoltLabSuite/Core/Controller/Clipboard.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Clipboard.js

index 7d099923574e046f5d5a531055c66ba8d85f7452..6df0aeeb37590cc537075c158bd37d0d6cfac6e5 100644 (file)
@@ -616,7 +616,7 @@ class ControllerClipboard {
 
       this.setParentAsMarked(data.markAll, markAll);
 
-      const parent = data.markAll.closest(".columnMark");
+      const parent = data.markAll.closest(".columnMark")?.parentNode as HTMLElement | null;
       if (parent) {
         if (markAll) {
           parent.classList.add("jsMarked");
index e2544126b83b63b5161a78a1144f04acbbace71a..b78b952464791831a1d4e4265dba99f83c8dc8fe 100644 (file)
@@ -452,6 +452,7 @@ define(["require", "exports", "tslib", "../Ajax", "../Core", "../Dom/Change/List
          * Rebuilds the mark state for each item.
          */
         rebuildMarkings(data, objectIds) {
+            var _a;
             let markAll = true;
             Array.from(data.checkboxes).forEach((checkbox) => {
                 const clipboardObject = checkbox.closest(".jsClipboardObject");
@@ -471,7 +472,7 @@ define(["require", "exports", "tslib", "../Ajax", "../Core", "../Dom/Change/List
             if (data.markAll !== null) {
                 data.markAll.checked = markAll;
                 this.setParentAsMarked(data.markAll, markAll);
-                const parent = data.markAll.closest(".columnMark");
+                const parent = (_a = data.markAll.closest(".columnMark")) === null || _a === void 0 ? void 0 : _a.parentNode;
                 if (parent) {
                     if (markAll) {
                         parent.classList.add("jsMarked");