JavaScript in Phoenix project

Note that DOMContentLoaded will only fire if document.readyState is still in the loading state. By the time it is set to interactive (or later complete) the DOMContentLoaded event has already been fired.

see