From 5a38e3c7b2f56b480f8e8d5f862fbff9197923dd Mon Sep 17 00:00:00 2001 From: Koen Cornelis Date: Thu, 2 Sep 2021 11:31:45 +0200 Subject: [PATCH] Fix the add attribute select in ie 10/11 Prior to this change, the select did not work because the event handler used the selectedOptions property, which does not work in IE (see: https://caniuse.com/?search=selectedoptions). This change reworks the code to use the value and select the correct option from there. All of that code is compatible with IE10/11 and modern browsers. --- mujina-idp/src/main/resources/public/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mujina-idp/src/main/resources/public/main.js b/mujina-idp/src/main/resources/public/main.js index 6368804..30948f0 100644 --- a/mujina-idp/src/main/resources/public/main.js +++ b/mujina-idp/src/main/resources/public/main.js @@ -28,8 +28,8 @@ document.addEventListener("DOMContentLoaded", function () { }); document.querySelector(".attribute-select").addEventListener("change", function (e) { - var selectedOption = e.target.selectedOptions[0]; - var val = selectedOption.value; + var val = e.target.value; + var selectedOption = document.querySelector('option[value="' + val + '"]'); var text = selectedOption.text; var multiplicity = selectedOption.dataset.multiplicity === "true"; var newElement = document.createElement("li");