Hi,
I have tried to use the same trick that Scriptaculous uses to dynamically include the various javascript files in the library (effect.js, dragdrop.js, etc). The following works in Safari but not in Firefox 1.5.0.1 on OS X. Expected result is the burp div is red background. Actual result is no red background.
I posted an even more stripped down version of the problem to bugzilla.
https://bugzilla.mozilla.org/show_bug.cgi?id=331174
Maybe a new workaround for the dynamic include problem for Scriptaculous needs to be found. If you turn my example around by swaping the order of the scriptaculous.js and burp.js <script> tags then the div will be red. However that means that Scriptaculous doesn't load properly. If someone uses this trick before they src scriptaculous.js then scriptaculous.js will not work.
Peter
test.html
<html>
<head>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js"></script>
<script type="text/javascript" src="burp.js"></script>
</head>
<body>
<div id="grof">Grof</div>
<div id="burp">Burp</div>
</body>
</html>
burp.js
var scriptTags = document.getElementsByTagName("script");
for(var i=0;i<scriptTags.length;i++) {
if(scriptTags[i].src && scriptTags[i].src.match(/burp\.js(\?.*)?$/)) {
var path = scriptTags[i].src.replace(/burp\.js(\?.*)?$/,'');
document.write('<script type="text/javascript" src="'+path+'burp2.js"></script>');
}
}
burp2.js
function b(){
var burp = document.getElementById("burp");
burp.style.background="red";
}
window.addEventListener("load", b, false);