Difference between revisions of "MediaWiki:Chameleon.js"
From VGD Wiki Farm
Line 1: | Line 1: | ||
docReady(function() { | docReady(function() { | ||
− | + | ||
}); | }); | ||
Line 11: | Line 11: | ||
document.addEventListener('DOMContentLoaded', fn); | document.addEventListener('DOMContentLoaded', fn); | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } |
Latest revision as of 13:25, 3 January 2021
docReady(function() {
});
function docReady(fn) {
// see if DOM is already available
if (document.readyState === 'complete' || document.readyState === 'interactive') {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}