tvler / lazy-progressive-enhancement

A lazy image loader designed to enforce progressive enhancement and valid HTML.
http://tylerdeitz.co/lazy-progressive-enhancement/
MIT License
190 stars 10 forks source link

Don't call parseMedia in the media loop #6

Closed tvler closed 8 years ago

tvler commented 8 years ago

Looks like

for (var i = 0; i < (media = parseMedia(media)).length; i++)

runs the parseMedia function for every loop iteration. I thought that it would just be called once for the variable setup.

This is pretty bad for performance, will fix.

tvler commented 8 years ago

Fixed in https://github.com/tvler/lazy-progressive-enhancement/commit/f89c1cc9378135ccde46db6f6dd1052340af03e4