Can't load jQueryUI in the right order

I've got a bit of a problem here...

I have a Web block that I use as a jQuery component. Its main JavaScript is in the JavaScript portion of the block, so if it gets loaded multiple times per page (and it often will), it will only have its script loaded once, in the <head> section of the page.

This JavaScript needs jQueryUI to be loaded.

Since I upgraded to OS v 8, and switched this block to use jQuery 1.8.3, this Web Block is causing problems, because jQueryUI is not loaded.

I tried using "AddJavaScriptTag" in the Preparation to have it load jQueryUI, but that is failing because it is putting the script tag for jQueryUI *before* the script tag for jQuery itself.

I tried setting "Defer" = True on "AddJavaScriptTag", and it is failing because the jQueriUI load is occurring AFTER the Web Block's script tag, so jQueryUI isn't loaded yet.

What do I need to do to:

1. Have jQueryUI load AFTER jQuery and
2. Have jQueryUI load BEFORE the Web Block's script runs and
3. NOT put the Web Block's script into an Expression on the script itself



Hi Justin.

I noticed that earlier too. Made some of my JS code break.
Maybe it's an 8.0 bug? (The switching of the order in which the pages load multiple javascript files)

This worked for me once, and I'm not sure if it's viable for you.
What I did was put jQuery and jQuery UI in a single block, pasting jQuery first and UI after.

I could do this because the whole site was using both, so no real harm done in forcing them to be together.

Antonio -

I ended up moving the entire block of JavaScript out of the Web Block's JavaScript and into an Expression, and loading jQueryUI before that also with an expression. It worked, but the component is showing other problems with newer versions of jQueryUI, so I am taking it out for the moment (it is a little-used piece of functionality).

But still, this points to a larger issue, which is that you should be able to use AddJavaScriptTag in Preparation to add script that uses jQuery.

Personally, I try not to user AddJavaScriptTag for anything. The load order was fine before 8.0.
I think the larger issue is actually that scripts changed their load order.

Maybe someone can tell us why, or if it's an issue with the current version.

Antonio -

I sometimes need the action to load from a CDN like Google's code repository. But I 100% agree that the issue is the altered load order.