mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
Rm id use (#912)
* rm unecessary code on output rendering on pyscript.py * Remove all ids from repl * Fix problems on rendering outside repl * fixing tests * Fixes repl and tes_py_repl * Fix zz tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test 864now works consistently Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -228,19 +228,18 @@ class Element:
|
||||
return self.element.innerHtml
|
||||
|
||||
def write(self, value, append=False):
|
||||
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
|
||||
out_element_id = child.id = f"{self.id}-{exec_id}"
|
||||
self.element.appendChild(child)
|
||||
|
||||
out_element = document.querySelector(f"#{out_element_id}")
|
||||
if self.element.children:
|
||||
out_element = self.element.children[-1]
|
||||
else:
|
||||
out_element = self.element
|
||||
|
||||
if mime_type in ("application/javascript", "text/html"):
|
||||
script_element = document.createRange().createContextualFragment(html)
|
||||
|
||||
Reference in New Issue
Block a user