… but you can’t change the position of the core scripts. jquery will always be inserted on top, except you use your custom javascript and disable clientScript at all.
Not sure why ALL core scripts have to be in the head but certainly jQuery: inserting script at the foot of the page is a performance improvement because it lets the rest of the HTML download before beginning scripts.
This is good for standard scripts. But to take advantage of jQuerys $.document.ready(function(){}); jQuery has to be loaded before that script loads, ok if it’s in a file but not for inlines as they’ll be hit and parsed before jQuery is loaded at the foot, hence it should be loaded in the head before HTML is parsed.
For what it’s worth, I made a custom modification to the CClientScript class, and added another POS_ constant, called POS_REPLACE. In your view, if you insert
<!-- js -->
The code will insert all your javascripts just after the html comment. Pretty nice if you’re trying to adhear to an HTML5 boilerplate template, for instance.
Let me know if you want the code and I’ll dig it up.