codyhouse / codyhouse-framework

A lightweight front-end framework for building accessible, bespoke interfaces.
https://codyhouse.co/
MIT License
1.16k stars 173 forks source link

Remove document write #41

Closed peiche closed 4 years ago

peiche commented 4 years ago

As of Chrome 55, pages containing a document.write script will not execute it on slower connections. Google's Lighthouse auditing tool even has a warning against it. The MDN docs also warn against using it.

This PR replaces the index page's document.write script with the recommended way of writing an element to the DOM. There is a shared function included to avoid unnecessarily repetitious code.

claudia-romano commented 4 years ago

Thanks Paul! I just merged your PR.

claudia-romano commented 4 years ago

Hi Paul. With the latest release (2.2.0), we reverted back to the previous document.write() function.

The solution proposed in this PR was creating issues on Firefox (style was not properly loaded once the page was cached). We are still looking for a solution to that.

About the document.write function: it looks like all warnings specifically refer to using the function to inject a Githubissues.

  • Githubissues is a development platform for aggregating issues.