Ticket #11198 (closed bug: invalid)
chrome and safari - when dynamically loading scripts and stylesheets
|Reported by:||soheilnb@…||Owned by:|
Maybe it is not a bug, or maybe I should refer the problem to Google and Apple bug-fix page.
I noticed that Safari and Chrome differ from other browsers when they try to load dynamic .js and .css files; i.e.; some code like
includeScript ("file1.js"); includeStyleSheet (file2.css");
in that in these two browsers, document.ready is triggered when the initial DOM model is fully loaded (but not yet all dynamic scripts and styles), therefore the standard jQuery document.ready may encounter some errors.
Apparently, the old-fashion
doesn't have such a problem, but sometimes it is annoying or impractical to change .html file apart from adding a single component load file:
<head> <script type="..." src="libsrc.js">...
I tried this code-fix successfully for a couple of occasions (coffee-script style);
$-> try # do init code catch e # add dynamically body onload handler to do the init code
I just wish to know if there is a better solution, or any hope to have this problem fixed in future versions of jQuery?
Thanks a lot.