Closed Itumac closed 11 years ago
Unless you have magical powers (which would be super cool), there is one reliable way to solve this: put the document ready call in the LazyLoad callback.
There are many unreliable ways to solve this, but they will all fail and they will all be a waste of time.
LazyLoad will tell you when everything has finished loading by executing its callback. If you're not willing to wait for the callback, your code may run before things finish loading, and there's nothing LazyLoad can do about it.
That's good enough for me coming from you. I can see those paths and they are all dark forest paths. I am looking into server based bundling solutions at the moment. Or a document.write spell! :)
I am testing LazyLoad as a way of delivering multiple UI framework files through two simple js includes. This way, developers don't have to include 20 or more links in their pages and I can update the files without requiring them to update their code.
The issue I am running into in my tests is that a jQuery document ready call placed at the end of a file can get called before the library files are loaded. This happens almost all the time in my test page.
Two restrictions: IE9 is the sole browser and adding the document ready call in the LazyLoad callback function is not an option. I can't control how people will design their apps.
Here is a sample of my page structure. In this example the chosen call fails as
Object doesn't support property or method 'chosen'
Please let me know if there is a workaround to this issue.
Thanks!
scriptloader.js Looks like this: