Add handling of cached images

A browser cached image might not trigger the onload event or we might not catch it in time.
Using Image.complete to set _isLoadingImage handle that edge case.