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

Fixed JS error when background-position has either "left" or "top" (fixe... #21

Closed jefferyto closed 11 years ago

jefferyto commented 11 years ago

...s #14)

When "left" is used, positions[ pos[0] ] evaluates to 0. Since this is false-y, the calculation moves onto parseFloat( pos[0] ) / 100, which evaluates to NaN (since it's trying to do parseFloat("left")). (A similar case occurs with "top".) This leads to a JS error later on.