spritespin
spritespin copied to clipboard
fix bug where images loaded from chrome cache results in 0 WIDTH elements
In some chrome versions (linux 54.0 being one of them) sometimes the getComputedStyle(data.target[0]).width
call in Spin.setLayout
returns the value auto
which makes the image width value 0 ( w = Number(style.width.replace('px', ''))|0; === 0
), thus making it invisible.
It usually happens when spritesbin fully loaded the images, then you change to another page and then you go back to the previous page using the browser back button. My best guess is that chrome triggers the img.onload
event for cached images without (or before) computing the image dimensions.