I switched to using onload instead of addEventListener because it is easier to remove the event handler from the clear() method this way.  (This was part of the race condition. If the user zoomed and then swiped, we'd display a new image, but this onload handler would still be attached to the image and would be triggered.)