> This kind of sounds nice, but perhaps some sort of django namespace > could be introduced. Meaning $jQD -> dj.$: > > <script type='text/javascript' src='django/jquery.js'></script> > <script type='text/javascript'> > var dj = {}; > dj.$ = dj.jQuery = jQuery.noConflict(true); > </script>
This is a great idea, it also means that we could have a setting for specifying which libraries to add to the django namespace, depending on what our apps and 3rdparty apps require. To elaborate: Say that by default the django namespace has two libraries inlcuded: <script type='text/javascript' src='django/jquery.js'></script> <script type='text/javascript' src='django/jquery_ui.js'></script> <script type='text/javascript'> var dj = {}; dj.jq = dj.jQuery = jQuery.noConflict(true); </script> Then individual apps could be given a way to add to this namespace, following some convention, say if you want a specific version of jQuery, say version 1.4, then you could add below the other stuff: <script type='text/javascript' src='django/jquery_1.4.js'></script> <script type='text/javascript'> dj.jq_1_4 = jQuery.noConflict(true); </script> And if you wanted som specific version of mootools or other library (which I don't know excactly how works, so I'm guessing): <script type='text/javascript' src='django/mootools_1.2.js'></script> <script type='text/javascript'> dj.moo_1_2 = MooTools = $; MooTools = $ = null; // or some equivalent of jQueries noConflict() function </script> To make use of these namespaces the widgets would have to wrap their library calls into closures, like so: dj.jq(function($) { // Here you can reference $ and be sure it's jQuery $('#some_id').some_awesome_jquery_plugin_name(); }); I don't know if other libraries than jQuery have this closure support, anyone? Could we brainstorm on this a bit? -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.