`parentElement` is no longer `element.parentNode` as `element` has been repositioned.
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();
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;