<img id="img" src="src/abc.jpg" onload="imgload()"/>
<script>
var img = document.getElementById("img");
img.remove()
function imgload(){
console.log("image loaded now")
}
</script>
Event though we removed the image from dom. the eventlistener was triggered. I know its a expected behaviour, but it seems like bug. please clarify.
This might not be an correct explanation for your question, but i try to expain it from my POV.
While performing some searches, it came to know that onload function on image is an asynchronous function as it is related to fetch request.
you can also refer this link
while you run this code you will get output as Output image
you will know that the img is being removed from the DOM. Thus this is asynchronous and does not depend on the image tag it depends on the image request.