Parabellum1905y / ufd

Automatically exported from code.google.com/p/ufd
GNU General Public License v2.0
0 stars 0 forks source link

Issues playing nice with prototype #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have an existing site that is using prototype that I am trying to add UFD
to. I have made the jQuery.noConflict(); change by adding
jQuery.noConflict(); as the first line in jQuery.ui.ufd.js and doing a find
/ replace for $ with jQuery in that file as well.

As soon as i remove my prototype ref, everything works as expected.

I am using prototype version 1.6.1_rc3.

This is the order that I'm loading scripts.
<script src="/javascripts/prototype.js" type="text/javascript"></script>
<script src="/javascripts/effects.js" type="text/javascript"></script>
<script src="/javascripts/controls.js" type="text/javascript"></script>

<script src="/javascripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/javascripts/ui.core.js" type="text/javascript"></script>
<script src="/javascripts/jquery.bgiframe.min.js"
type="text/javascript"></script>
<script src="/javascripts/ufd/jquery.ui.ufd.js"
type="text/javascript"></script>

Original issue reported on code.google.com by levi.ro...@gmail.com on 26 Jan 2010 at 2:26

GoogleCodeExporter commented 8 years ago
You shouldn't need to do any changes for this plugin; it is jQuery.noConflict()
compatible.  The whole plugin is wrapped inside a function scope using jQuery
anonymouse function invoked immediately: 

(function($){
  // plugin code:
  // code refers to "$", which is declared and passed in above

})(jQuery) //invoke this anonymous function immediately, passing in (global) 
jQuery

So the $ used internally is not actually the global one.  

You need to ensure that noConflict is called before _any_ of your prototype code
executes, and definitely _outside_ the plugin closure.

[http://api.jquery.com/jQuery.noConflict/]
See [http://docs.jquery.com/Plugins/Authoring#Custom_Alias_in_plugin_code]

Original comment by thetoolman on 3 Feb 2010 at 8:49

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

Original comment by thetoolman on 3 Feb 2010 at 8:53