johnangularjs / google-ajax-apis

Automatically exported from code.google.com/p/google-ajax-apis
0 stars 0 forks source link

Jquery with noConflict() #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am a asp.net developer and use jQuery many places. I used jQuery from
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js. I am
developing some modules using DotNetNuke framework. Because I work in
portal environment it is very important for me to make sure lib I use don't
conflict with other.

jQuery already handle such situation with call of jQuery.noConflicts(). Can
we have jQuery file host with jQuery.noConflicts() statement?

Original issue reported on code.google.com by AgrawalA...@gmail.com on 9 Jun 2008 at 7:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Agrawal --

To be clear on the situation, you want us to host versions of JQuery that call
jQuery.noConflicts() in them?

Unless there is overwhelming support for this, we will probably hold off on this
because we are aiming at supporting only the highly requested files.  Each new
library/variation we implement requires extra overhead.

My best guess would be that you can set that up before you load jQuery from us.

-Ben

Original comment by internal...@gmail.com on 18 Jun 2008 at 9:00

GoogleCodeExporter commented 8 years ago
Why would you need this? Just put:

<script type="text/javascript">jQuery.noConflict()</script>

right after the jquery script tag

(http://docs.jquery.com/Core/jQuery.noConflict)

Original comment by jdsw...@gmail.com on 15 Jul 2008 at 12:22

GoogleCodeExporter commented 8 years ago
The problem with adding:

<script type="text/javascript">jQuery.noConflict()</script>

is that you have to do this in the google OnLoadCallback function. And it's not 
sure
when this is executed. Mean while other libraries can be loaded and create a 
conflict.

example:
1) first we load jquery with google load
2) we load any library (e.g. mootools) 
3) after jquery is loaded in runs jQuery.noConflict() resetting the $-function 
to
it's previous version (before jquery was loaded). $ wasn't assigned so it reset 
to an
undefined function.
Conclusion: The $-function works with mootools only between step2 and step3. 
After
step3 it's unassigned.

if you swich step 1 and 2:
1) first load any library (e.g. mootools) 
2) we load jquery with google load
3) after jquery is loaded in runs jQuery.noConflict() resetting the $-function 
to the
mootools function.
Conclusion: The $-function works with mootools but while the jquery is being 
loaded
the $-function is reassigned to jQuery only when jQuery is fully loaded and the
jQuery.noConflict() is executed the $-fuction is reassigned to mootools.

I have put an example html as attachment to see the effect of the $-function.

Original comment by cee...@gmail.com on 19 May 2010 at 3:15

Attachments: