mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 04:03:00 -05:00
[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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user