SlexAxton/yepnope.js — pull request #105 by mikeycgto (2012-03-28 15:24:54+00:00)
Title: updates to CSS plugin

A project of mine uses Media Queries and CSS and we needed to use the CSS plugin to delay execution otherwise our JS would execute without proper sizing rules being applied.

I found the plugin was not working properly all of the time (about half the time my JS would execute before the CSS was available). With a bit of debugging I found that `document.styleSheets` sometimes did not contain the newly injected link element. When this is the case, the original the `poll` function is only executed once and `onload` is always called. Basically, the `for` loop does not find a stylesheet with `id` and exception is never created.

I modified the code to handle this case and it seems to work every time now within my Project (when the media queries aren't available dynamically created elements aren't sized properly and it's very easy to know the load order was incorrect)

I'm not sure how I should test this. Any ideas?