it is perfectly acceptable to do what you asked for:
$(function(){
console.log('DOM ready');
});
window.load = function(){
console.log('window loaded');
};
you can also do this to make sure the DOM is ready before checking for a load event
$(function(){
$(window).on('load',function(){
console.log('window loaded');
});
console.log('DOM ready');
});
or with native javascript for the window.load event
$(function(){
window.load = function(){
console.log('window loaded');
};
console.log('DOM ready');
});
Even the jQuery API docs ready () says it's ok: http://api.jquery.com/ready/
You can do this to make sure the DOM is ready before checking the window.load event. It may be posted out yes, but sometimes due to various browser inconsistencies and loading other scripts.
window.load, , , window.load , DOM , .
jQuery ready, , . ready() window.load , , .. .