Difference between revisions of "MediaWiki:Chameleon.js"
From VGD Wiki Farm
(7 intermediate revisions by the same user not shown) | |||
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);
}
}