Fix `Ui/ItemList` for textareas
authorMatthias Schmidt <gravatronics@live.com>
Sun, 17 Jan 2021 12:31:09 +0000 (13:31 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 17 Jan 2021 12:31:09 +0000 (13:31 +0100)
`parentElement` is no longer `element.parentNode` as `element` has been repositioned.

ts/WoltLabSuite/Core/Ui/ItemList.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js

index 8d3de3b4a380a31e76406dc9a01f8a3fb312ff4c..d107695b31504986e88eddf2e1da1ddb0639ffe9 100644 (file)
@@ -85,7 +85,7 @@ function createUI(element: ItemListInputElement, options: ItemListOptions): UiDa
     if (element.nodeName === "TEXTAREA") {
       const inputElement = document.createElement("input");
       inputElement.type = "text";
-      parentElement.insertBefore(inputElement, element);
+      element.parentNode!.insertBefore(inputElement, element);
       inputElement.id = element.id;
 
       element.remove();
index ab625545f48c689fc3d82bb3db74c7bcef91617d..84969cab6d179eee141476d7add14abfa95821b0 100644 (file)
@@ -76,7 +76,7 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Traverse", "../Languag
             if (element.nodeName === "TEXTAREA") {
                 const inputElement = document.createElement("input");
                 inputElement.type = "text";
-                parentElement.insertBefore(inputElement, element);
+                element.parentNode.insertBefore(inputElement, element);
                 inputElement.id = element.id;
                 element.remove();
                 element = inputElement;