JavaScript Defer bugs Created
This filter is considered high risk this Google developers site
JavaScript whose logic depends on the state of the DOM may behave differently when Defer JavaScript is turned on.
It speeds up the site tremendously but it will cause a few error's that we need to fix.
The JS is not loaded before the DOM so any button that is supposed have JS when clicked will fail. For example the close or reopen issue button on the issue page is directly linked to a JS event. If you click it before the JS loads and after the DOM loads (when you can see the button) this will happen.
to reproduce:
- Go to an issue page and refresh.
- As soon a you see the open and close button click it.
- If you get it before the page loads this error will happen.
To fix this, technically we should not have any buttons available that are directly in the HTML that are attached to event listeners before the JS is fully loaded.
Thankfully writing your templates in .vue
files and .js
files solves this but it will affect a bunch of still major places.
I am wondering if we should rewrite any places where this can happen in Vue to prevent this from happening.