mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-15 02:24:04 +00:00
fix(core): run script when DOM is ready
Sometimes the scripts start to run before DOM is fully ready. It causes things like #475 where the checkbox is not in DOM yet but the script is already asking for it.
This commit is contained in:
parent
9d8a631f44
commit
eba22354e5
|
@ -117,4 +117,10 @@ function main( window ) {
|
|||
mw.loader.load( 'skins.citizen.preferences' );
|
||||
}
|
||||
|
||||
if ( document.readyState === 'interactive' || document.readyState === 'complete' ) {
|
||||
main( window );
|
||||
} else {
|
||||
document.addEventListener( 'DOMContentLoaded', function () {
|
||||
main( window );
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue