JSFiddle - React, Tailwind, and code Playground

by alexdickson

HTML

<img src="http://r0k.us/graphics/kodak/kodak/kodim08.png" alt="Image">

JavaScript

// This code is being executed just before the closing `</body>` tag.
var img = document.images[0];

// Break the browser's cache of the image for this example.
img.src = img.src + '?cache_bust=' + +new Date;

// Should be `false` as the image has not loaded.
// Why is it returning `true`?
console.log(1, img.complete);

img.addEventListener('load', function() {
    // Should be `true` as the image *has* loaded.
    console.log(2, img.complete);    
}, false);