Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c8c08e

Browse files
committed
Merge pull request gridstack#309 from andrewr88/master
Fixes for Lodash v4.0 breaking changes
2 parents 83ac5af + bce1eea commit 7c8c08e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/gridstack.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@
104104
}
105105

106106
while (true) {
107-
var collision_node = _.find(this.nodes, function(n) {
107+
var collision_node = _.find(this.nodes, _.bind(function(n) {
108108
return n != node && Utils.is_intercepted(n, nn);
109-
}, this);
109+
}, this));
110110
if (typeof collision_node == 'undefined') {
111111
return;
112112
}
@@ -117,9 +117,9 @@
117117

118118
GridStackEngine.prototype.is_area_empty = function(x, y, width, height) {
119119
var nn = {x: x || 0, y: y || 0, width: width || 1, height: height || 1};
120-
var collision_node = _.find(this.nodes, function(n) {
120+
var collision_node = _.find(this.nodes, _.bind(function(n) {
121121
return Utils.is_intercepted(n, nn);
122-
}, this);
122+
}, this));
123123
return collision_node == null;
124124
};
125125

@@ -131,7 +131,7 @@
131131
this._sort_nodes();
132132

133133
if (this.float) {
134-
_.each(this.nodes, function(n, i) {
134+
_.each(this.nodes, _.bind(function(n, i) {
135135
if (n._updating || typeof n._orig_y == 'undefined' || n.y == n._orig_y)
136136
return;
137137

@@ -150,10 +150,10 @@
150150
}
151151
--new_y;
152152
}
153-
}, this);
153+
}, this));
154154
}
155155
else {
156-
_.each(this.nodes, function(n, i) {
156+
_.each(this.nodes, _.bind(function(n, i) {
157157
if (n.locked)
158158
return;
159159
while (n.y > 0) {
@@ -176,7 +176,7 @@
176176
n._dirty = n.y != new_y;
177177
n.y = new_y;
178178
}
179-
}, this);
179+
}, this));
180180
}
181181
};
182182

@@ -753,9 +753,9 @@
753753
};
754754

755755
GridStack.prototype.remove_all = function(detach_node) {
756-
_.each(this.grid.nodes, function(node) {
756+
_.each(this.grid.nodes, _.bind(function(node) {
757757
this.remove_widget(node.el, detach_node);
758-
}, this);
758+
}, this));
759759
this.grid.nodes = [];
760760
this._update_container_height();
761761
};

0 commit comments

Comments
 (0)