8000 Follow up - Remove all innerHTML += for consistency sake (#2159) · pyscript/pyscript@ee3cd76 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee3cd76

Browse files
Follow up - Remove all innerHTML += for consistency sake (#2159)
1 parent eb31e51 commit ee3cd76

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pyscript.core/src/plugins/py-editor.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ async function execute({ currentTarget }) {
9191
return envs.get(env).then((xworker) => {
9292
xworker.onerror = ({ error }) => {
9393
if (hasRunButton) {
94-
outDiv.innerHTML += `<span style='color:red'>${
95-
error.message || error
96-
}</span>\n`;
94+
outDiv.insertAdjacentHTML(
95+
"beforeend",
96+
`<span style='color:red'>${
97+
error.message || error
98+
}</span>\n`,
99+
);
97100
}
98101
console.error(error);
99102
};
@@ -108,7 +111,10 @@ async function execute({ currentTarget }) {
108111
};
109112
sync.writeErr = (str) => {
110113
if (hasRunButton) {
111-
outDiv.innerHTML += `<span style='color:red'>${str}</span>\n`;
114+
outDiv.insertAdjacentHTML(
115+
"beforeend",
116+
`<span style='color:red'>${str}</span>\n`,
117+
);
112118
} else {
113119
notify(str);
114120
console.error(str);

0 commit comments

Comments
 (0)
0