Image container instead of event object in image load event handler
- by avok00
I stumbled upon a very strange thing. In FF 3.6 (not tested others yet) I add onload handler to an image like this:
imgRef.addEventListener("load", activateLink, false);
When load event fires, in activateLink(evt) the evt paramater is not an event, but the "a" tag that contains the image. Why is this?
function activateLink(evt) {
// evt turns out to be a refference to <a> tag (HTMLAnchorElement) that contains the image.
// Actually two of them. Both dynamically added with addElement.
}
I remembered another fact that may be relevant. I have multiple images with the same src that all have registered this same event handler activateLink. Could this be the problem?