PR: replace insecure, deprecated usage of document.write with insertAdjacentText

28 views
Skip to first unread message

laundmo

unread,
Sep 16, 2025, 12:16:33 PM (13 days ago) Sep 16
to py4web
Since the recent updates, Grid.represent_by_type started working. Its datetime/date/time represent functions were using document.write, a old deprecated API with bad behaviour (like replacing the entire page content if the script tag happens to be written later through ajax).

In this PR https://github.com/web2py/py4web/pull/1000 i replace that by using insertAdjacentText instead, which has essentially the same effect.

i've also switched it to using f-strings and js isoformat parsing, because its far nicer code this way

Massimo DiPierro

unread,
Sep 18, 2025, 1:06:24 AM (11 days ago) Sep 18
to py4web
Nice. Thanks!
Reply all
Reply to author
Forward
0 new messages