2

Closed

Script files included on the page in the incorrect order

description

As noted in discussion 401601, I have experienced rare occasions where the scripts included on the page where not rendered in the same order in which they were declared. This causes problems when one script is dependent on another.

In my case, I was using the following to add scripts to the page:

Script.Require("jQuery");
Script.Include("bootstrap.min.js");
Script.Include("jquery.jCarousellite_1.0.1.min.js");
Script.Include("BootstrapCasino.js");

This was performing as expected for a long time- and then out of the blue, the order the scripts were rendered was changed. As a workaround, I appended .AtHead() to the jQuery require. I then removed the .AtHead() method and the scripts were again displayed in the order that you would expect them to be.

This problem appears to be very intermittent and I have not since been able to reproduce. One thing that may be of worth to note is that the scripts appeared to have been rendered in the order of all the Script.Includes first, and then the Script.Requires after eg as if they were declared as follows:

Script.Include("bootstrap.min.js");
Script.Include("jquery.jCarousellite_1.0.1.min.js");
Script.Include("BootstrapCasino.js");
Script.Require("jQuery");
Closed Dec 18, 2012 at 8:48 AM by sebastienros
Should be fixed in 1.x now, please check

comments

paynecrl97 wrote Nov 21, 2012 at 12:31 PM

This is a duplicate of 19235