use text nodes instead of innerHTML
This commit is contained in:
parent
610b20019b
commit
caa1fccea3
@ -111,7 +111,7 @@ class FormElement extends InterfaceElement {
|
|||||||
break;
|
break;
|
||||||
case "button":
|
case "button":
|
||||||
this.handle = document.createElement("button");
|
this.handle = document.createElement("button");
|
||||||
this.handle.innerHTML = label;
|
this.handle.appendChild(document.createTextNode(label));
|
||||||
label = "";
|
label = "";
|
||||||
dataType = "none"
|
dataType = "none"
|
||||||
break;
|
break;
|
||||||
@ -125,7 +125,7 @@ class FormElement extends InterfaceElement {
|
|||||||
|
|
||||||
if (label !== "") {
|
if (label !== "") {
|
||||||
this.label = document.createElement("label");
|
this.label = document.createElement("label");
|
||||||
this.label.innerHTML = label;
|
this.label.appendChild(document.createTextNode(label));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
@ -230,11 +230,11 @@ class FormElement extends InterfaceElement {
|
|||||||
let box = document.createElement("div");
|
let box = document.createElement("div");
|
||||||
box.classList.add(type);
|
box.classList.add(type);
|
||||||
box.classList.add("alert");
|
box.classList.add("alert");
|
||||||
box.innerHTML = message;
|
box.appendChild(document.createTextNode(message));
|
||||||
|
|
||||||
if (title !== "") {
|
if (title !== "") {
|
||||||
let titleTag = document.createElement("strong");
|
let titleTag = document.createElement("strong");
|
||||||
titleTag.innerHTML = title;
|
titleTag.appendChild(document.createTextNode(title));
|
||||||
box.prepend(titleTag);
|
box.prepend(titleTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,13 @@ let out = new FormElement({
|
|||||||
form: form
|
form: form
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let button = new FormElement({
|
||||||
|
id: "button",
|
||||||
|
type: "button",
|
||||||
|
label: "Do things",
|
||||||
|
form: form
|
||||||
|
});
|
||||||
|
|
||||||
let outAdvanced = new FormElement({
|
let outAdvanced = new FormElement({
|
||||||
id: "output-advanced",
|
id: "output-advanced",
|
||||||
type: "output",
|
type: "output",
|
||||||
@ -47,3 +54,6 @@ let outAdvanced = new FormElement({
|
|||||||
advanced: true,
|
advanced: true,
|
||||||
form: form
|
form: form
|
||||||
});
|
});
|
||||||
|
|
||||||
|
inp.alertBox("alert-info", "Pater noster qui es in caelo sanctificetur nomen tuum adveniat regnum tuum.");
|
||||||
|
button.handle.addEventListener("click", form.clearAlerts);
|
||||||
|
Loading…
Reference in New Issue
Block a user