To throw another curveball, all scripts will likely be loaded
asynchronously or via script DOM elements - I think that's what's
leading to the race conditions.  My real goal here is to rename the jQ
object before it's loaded and I'm hoping that it can be done
programmatically rather than after the script is loaded or via a find
and replace (which I'd end up coding in Perl or something).

On Oct 27, 3:59 pm, Michael Geary <m...@mg.to> wrote:
> If your <script> tag that loads jQuery is immediately followed by another
> <script> tag that calls noConflict, there should be no race conditions.
>
> You're not putting the noConflict call inside a $(document).ready() or the
> like, are you? It should be directly executed in a <script> tag:
>
> <script type="text/javascript" src="my.jquery.js"></script>
> <script type="text/javascript">
>     var jq = jQuery.noConflict();
> </script>
>
> -Mike
>
>
>
> On Tue, Oct 27, 2009 at 9:42 AM, El Greg <greglaval...@gmail.com> wrote:
>
> > Sorry - should have mentioned - I tried using jQuery.noConflict() as
> > well as jQuery.noConflict(true) and reassigning to a variable, but ran
> > into race conditions where another version of jQuery was executing a
> > call before I could call noConflict()... I'm hoping to namespace my
> > own separate version of jQuery sitting in another file such that I
> > only have to do one script src call and end up with a myjQuery instead
> > of jQuery.
>
> > Thanks again for your help!
>
> > On Oct 27, 11:08 am, "Dan G. Switzer, II" <dswit...@pengoworks.com>
> > wrote:
> > > See the $.noConflict() docs:
> >http://docs.jquery.com/Core/jQuery.noConflict
>
> > > var j = *jQuery.noConflict*();
> > > // Do something with jQuery
> > > j("div p").hide <http://docs.jquery.com/Effects/hide>();
> > > // Do something with another library's $()
> > > $("content").style.display = 'none';
>
> > > -Dan
>
> > > On Tue, Oct 27, 2009 at 10:25 AM, El Greg <greglaval...@gmail.com>
> > wrote:
>
> > > > I'm interested in namespacing jQuery to something like $myjQ.  or myjQ.
> > > > $ and wondering what the best way is to do it.  I will potentially be
> > > > using my version of jQuery on other pages that are running other
> > > > versions of jQuery - hence the idea to rename it completely so that I
> > > > have control over version, plugins, etc.  I thought about just doing a
> > > > find and replace on the word "jQuery" in the source, but I'm hoping
> > > > there's an easier way.
>
> > > > Thanks!

Reply via email to