I'm working on a highly asynchronous and compartmentalized component system where components each manage their own list of assets including js and css files.
I've recently started using jQuery to implement popup dialogs that use an Ajax callback to populate the dialog with one of my components. This component needs to work in both a full page context and within a div based dialog. I don't want the component itself to have to know whether it's being used in one context or the other. As it turns out, the first component I loaded into my jquery.ui.dialog itself uses jquery and dutifully pulled in the jQuery.js library. It seems the jquery ajax handler handles embedded <script> tags. This summarily clobbered my first instance of jQuery causing all kinds of ".dialog is not a function" errors. Adding a conditional around jquery.js to test if it's already been loaded seems to work like a champ in both FF and MSIE: if ( typeof( jQuery ) == 'undefined' ) { ...rest of jquery.js... } The question is, is there some reason this isn't an acceptable safeguard? --------------------------------------------------------------- Yermo Lamers DTLink, LLC Co-Founder & Developer http://www.dtlink.com http://www.collabinvest.net - Instant Social Investing Don't invest alone, Profit Together! ---------------------------------------------------------------