I'm using the polyfill picturefill to add support for the img
attributes srcset
and sizes
in browsers like IE.
This polyfill doesn't work when precompiling the javascript in the asset pipeline in rails. It DOES work when I exclude it from the pipeline and include it (picturefill) at the end of my <body>
tag.
My guess is that picturefill gets executed before the page has fully been loaded (with all 'img' tags). Is this correct? And if so, why didn't the authors add something like a document.ready() event? Is there a way I can solve this more elegant than including the whole script at the end of my body? Adding the script like this seems like a huge performance hit.