8000 Fix #1780 - Clean up elements before writing by WebReflection · Pull Request #1781 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Fix #1780 - Clean up elements before writing #1781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pyscript.core/src/stdlib/pyscript/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io
import re

from pyscript.magic_js import document, window, current_target
from pyscript.magic_js import current_target, document, window

_MIME_METHODS = {
"__repr__": "text/plain",
Expand Down Expand Up @@ -154,8 +154,10 @@ def display(*values, target=None, append=True):
# if element is a <script type="py">, it has a 'target' attribute which
# points to the visual element holding the displayed values. In that case,
# use that.
if element.tagName == 'SCRIPT' and hasattr(element, 'target'):
if element.tagName == "SCRIPT" and hasattr(element, "target"):
element = element.target

for v in values:
if not append:
element.replaceChildren()
_write(element, v, append=append)
0