What I want is to be notified when all images are loaded after DOM change. I know there is a jQuery plugin, but I'm wondering if there is any native method.
Example of code that does not work: https://jsfiddle.net/wanpd5su/3/
// Real implementation will do an AJAX request to retrieve new
// document content. This one just sets a timeout instead.
$('#button').on('click', function doAjaxRequest() {
    // This function changes the document content so that it
    // contains new uncached images.
    window.setTimeout(function changeContent() {
        document.body.innerHTML = '<div id="div" style="background-image:url(\'http://lorempixel.com/800/600/abstract/?' + Math.random() + '\'); height:600px; width:800px;"></div>';
        // This handler should run when new conent
        // is ready and all images are loaded.
        // BOT IT DOES NOT :(
        $(window).on('load', function onLoad() {
            alert('Document updated successfully.');
        });
    }, 1000);
});
