Hi, I'm using jQuery in a high conflict situation, ie. multiple
versions of jQuery in one page.
Unfortunately I have no way around this other than not using the latest jQuery.

So first off, jQuery 1.2 is loaded and noConflict() called.
Later, jQuery 1.3.2 is loaded and fed into a closure as such:

(function($) {
...
})( jQuery.noConflict(true) );

Within the closure if I try to dynamically load some html that
contains script then the script will be executed with jQuery 1.2 as
the global jQuery object.
I believe it would be more appropriate to temporarily set the global
jQuery to the one loading the script, ie. 1.3.2 in this case.

I've got two demo's, first without the patch, second with the patch:

http://test3.internal.adaptavist.net/~mgibson/versions/load1.html
http://test3.internal.adaptavist.net/~mgibson/versions/load2.html

It this worth considering, shall I raise a ticket?


Here's the patch:

Index: src/core.js
===================================================================
--- src/core.js (revision 6319)
+++ src/core.js (working copy)
@@ -290,7 +290,10 @@
                        // Inspired by code by Andrea Giammarchi
                        // 
http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
                        var head = document.getElementsByTagName("head")[0] ||
document.documentElement,
-                               script = document.createElement("script");
+                               script = document.createElement("script"),
+                               globaljQuery = window.jQuery;
+                       
+                       window.jQuery = jQuery;

                        script.type = "text/javascript";
                        if ( jQuery.support.scriptEval ) {
@@ -303,6 +306,8 @@
                        // This arises when a base node is used (#2709).
                        head.insertBefore( script, head.firstChild );
                        head.removeChild( script );
+                       
+                       window.jQuery = globaljQuery;
                }
        },

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to