Fix retina.js with images not currently visible on the page.
Review Request #5504 — Created Feb. 18, 2014 and submitted — Latest diff uploaded
retina.js has a bug (which has a few issues and pull requests filed)
where any images not currently displayed (either throughdisplay: none
on
the image or on a parent) will end up with a width and height of 0.The solution appears to be to use the
naturalWidth
andnaturalHeight
properties instead ofoffsetWidth
andoffsetHeight
. Others have deployed
this without problems, and it works for the cases I've hit as well.The problem is that we now have to maintain this, but hopefully the next
time retina.js puts out a release, it'll include a fix.
Hit this issue with the new change description stuff. Any file attachments
shown on a collapsed box ended up with a 0 width and height.After this fix, I could see the images, and they had a correct width and height.