[FIX] output management cleanups (#464)

* return on \n before empty div is appended

* use appendOutput with out.write

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Mariano Weber <info@uiremotely.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
marianoweber
2022-05-27 07:21:47 +02:00
committed by GitHub
parent 5d733ab915
commit eaacd45672
2 changed files with 6 additions and 5 deletions

View File

@@ -153,6 +153,10 @@ class Element:
out_element_id = self.id
html, mime_type = format_mime(value)
if html == "\n":
return
if append:
child = document.createElement("div")
exec_id = self.element.childElementCount + 1
@@ -161,13 +165,10 @@ class Element:
out_element = document.querySelector(f"#{out_element_id}")
html, mime_type = format_mime(value)
if mime_type in ("application/javascript", "text/html"):
script_element = document.createRange().createContextualFragment(html)
out_element.appendChild(script_element)
else:
if html == "\n":
return
out_element.innerHTML = html
def clear(self):