Skip to content

Avoid document write in single script linker loading - #9847

Merged
niloc132 merged 1 commit into
gwtproject:mainfrom
jhickman:9797
Nov 15, 2023
Merged

niloc132 merged 1 commit into
gwtproject:mainfrom
jhickman:9797

Conversation

@jhickman

@jhickman jhickman commented Aug 15, 2023 •

Copy link
Copy Markdown
Contributor

Not that this is scoped solely with the SingleScriptLinker (<add-linker name="sso" />) and not with the other occurrences of document.write

- replaces PR gwtproject#9814
 - due to currentScript not being fully supported, wrapped in conditional
- fixes issue gwtproject#9797
niloc132 pushed a commit that referenced this pull request Nov 15, 2023
This PR avoids `document.write` in Chrome browser. It cannot be simply
removed for all browsers for reasons mentioned in the code comment (I
verified it's still valid in Firefox, didn't check Safari or IE).

*Motivation*
Same as #9847 -- `document.write`
is considered bad for perfomance (flagged by Lighthouse performance
audits) and completely forbidden in some contexts (chrome extensions,
packaged chrome apps).

*Testing*
This is part of GeoGebra codebase for a few months (via
geogebra/geogebra@ac5c880)
and we didn't notice any problems.

Co-authored-by: Zbynek Konecny <zbynek@geogebra.at>
@niloc132
niloc132 merged commit 84fa2a1 into gwtproject:main Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants