-
Notifications
You must be signed in to change notification settings - Fork 757
Description
Issue details
Chrome and Brave will display a warning in the console:
resize:38 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
Steps to reproduce/test case
- Setup browser-sync to either behave as a proxy or a static server
- Run browser-sync
- Visit the browser-sync webserver
- Open the inspector in either Chrome or Brave
Please specify which version of Browsersync, node and npm you're running
- Browsersync [ 2.27.5]
- Node [16.10.0]
- Npm [7.24.0]
It seems to me like using document.write is considered a bad-practice. Based on #1849 (comment) it was argued that it doesn't matter given its only running in development.
It's understandable that it's a non-issue given it's only used in development, but it seems to me like it would be worth fixing to avoid the warning. Subjectively, I feel it sets a better example not using APIs like document.write for devs just getting started and future web devs.
The warning does link to https://developers.google.com/web/updates/2016/08/removing-document-write but that really mostly affects production sites, which is a non-issue here.
Lastly, I would be willing to write a PR to fix it if a maintainer is onboard with changing it. My instinct would be to use document.createElement and document.body.appendChild APIs instead, open to recommendations if there's a better API. Would you be up for a PR to fix this?
