📜 ⬆️ ⬇️

Another implementation of DOM onReady

Source: webreflection.blogspot.com

Based on the analysis of the solution , Andrea Giammarchi proposed a beautiful, cross-browser version ...


rate:
onReady = (function(ie){
var d = document;
return ie ? function(c){
var n = d.firstChild,
f = function(){
try{
c(n.doScroll('left'))
}catch(e){
setTimeout(f, 10)
}
}; f()
} :
/webkit|safari|khtml/i.test(navigator.userAgent) ? function(c){
var f = function(){
/loaded|complete/.test(d.readyState) ? c() : setTimeout(f, 10)
}; f()
} :
function(c){
d.addEventListener("DOMContentLoaded", c, false);
}
})(/*@cc_on 1@*/);

onReady(function(){
alert("Hello DOM");
});

')

Source: https://habr.com/ru/post/14481/


All Articles