jonom / silverstripe-betternavigator

Front-end utility menu for SilverStripe websites featuring administration and development tools
60 stars 31 forks source link

Only hook to DOMContentLoaded while loading - SS3 branch #36

Closed michalkleiner closed 6 years ago

michalkleiner commented 6 years ago

If the browser supports DOMContentLoaded event, the initialisation routine listener should be added when the event hasn't occured yet (i.e. the document is still loading).

When JS files are loaded asynchronously, the complete event has already been fired and BN doesn't get initialised.

Note: Possible states for the document.readyState that might be relevant to this are 'loading', 'interactive' and 'complete'. Relevant discussion: https://stackoverflow.com/a/9237129/2303501

michalkleiner commented 6 years ago

I'll create it again, realised I need to reset a bit back to remove the SS4 specific commits.