ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.04k stars 1.2k forks source link

AMD version fails if jQuery is not defined as a global #493

Open glenpike opened 9 years ago

glenpike commented 9 years ago

register_widget function uses "jQuery" variable rather than the "$" which is local to the factory function.

Can be fixed with:

git diff src/jquery.gridster.js
diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js
index 7bac911..8a78907 100755
--- a/src/jquery.gridster.js
+++ b/src/jquery.gridster.js
@@ -839,7 +839,7 @@
     *  than the original.
     */
     fn.register_widget = function($el) {
-        var isDOM = $el instanceof jQuery;
+        var isDOM = $el instanceof $;
         var wgd = isDOM ? this.dom_to_coords($el) : $el;
         var posChanged = false;
         isDOM || ($el = wgd.el);