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:
Mariana Meireles
2022-12-02 00:59:21 +01:00
committed by GitHub
parent 33d49ad87d
commit 72e23ac86f
4 changed files with 45 additions and 31 deletions

View File

@@ -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)