Skip to content

Commit 4abd56f

Browse files
Allow null input switches in switching addon
1 parent 677c67b commit 4abd56f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/addons/addons/block-switching/userscript.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,15 +1096,17 @@ export default async function ({ addon, console, msg }) {
10961096
const valueElement = document.createElement("value");
10971097
valueElement.setAttribute("name", inputName);
10981098

1099-
const shadowElement = document.createElement("shadow");
1100-
shadowElement.setAttribute("type", inputData.shadowType);
1099+
if (inputData.shadowType) {
1100+
const shadowElement = document.createElement("shadow");
1101+
shadowElement.setAttribute("type", inputData.shadowType);
11011102

1102-
const shadowFieldElement = document.createElement("field");
1103-
shadowFieldElement.setAttribute("name", getShadowFieldName(inputData.shadowType));
1104-
shadowFieldElement.innerText = callIfFunction(inputData.value);
1103+
const shadowFieldElement = document.createElement("field");
1104+
shadowFieldElement.setAttribute("name", getShadowFieldName(inputData.shadowType));
1105+
shadowFieldElement.innerText = callIfFunction(inputData.value);
11051106

1106-
shadowElement.appendChild(shadowFieldElement);
1107-
valueElement.appendChild(shadowElement);
1107+
shadowElement.appendChild(shadowFieldElement);
1108+
valueElement.appendChild(shadowElement);
1109+
}
11081110
xml.appendChild(valueElement);
11091111
}
11101112
}

0 commit comments

Comments
 (0)