The most probable explanation is that the browser remembers last successfully loaded content - when you change the source into empty string the browser has "nothing" to cache so there is a chance the engine of the specific browser (or all of them) leaves the cache unchanged - try changing the source into something like "pixel image" in your deleteImage function like this:
theImage.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNiYAAAAAkAAxkR2eQAAAAASUVORK5CYII=';
it will load a transparent 1x1px png and probably replace the cached image.
...or use the cache controlling headers on the server - to tell the browser not to cache.
on the second thought
in your delete fuction add this line:
inputImageFile.value = '';
it works now ;)
it looks like the input plays the role - the value is being cached - and when browser sets the value from cache - i guess the 'input' event fires - and your script displays the image ;)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…