louisremi / background-size-polyfill

Adds support for background-size "cover" and "contain" to IE8
http://louisremi.github.com/background-size-polyfill/
MIT License
1.26k stars 359 forks source link

Check for undefined explicitly #52

Closed danielshorten closed 1 year ago

danielshorten commented 10 years ago

I was having a problem similar to issue #15. I'm using a Bootstrap carousel and non-visible images seem to have zero values for innerWidth and innerHeight, so they are getting a display: none style applied. This may be expected behaviour, but it results in invisible images when the carousel is rotated until the browser window is resized. This patch solves my problem.

I'm not sure which invalid condition this if statement is trying to avoid. Perhaps !isNan() would be a better check.