Skip to content

Commit d1cb2eb

Browse files
authored
Merge pull request #1483 from adumesny/develop
null checks
2 parents d5a78f0 + e53b226 commit d1cb2eb

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/gridstack-dd.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
123123

124124
// see if we already have a node with widget/height and check for attributes
125125
let node = el.gridstackNode || {};
126-
if (!node.width || !node.height) {
126+
if (el.getAttribute && (!node.width || !node.height)) {
127127
let w = parseInt(el.getAttribute('data-gs-width'));
128128
if (w > 0) { node.width = w; }
129129
let h = parseInt(el.getAttribute('data-gs-height'));
@@ -180,6 +180,7 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
180180
}
181181

182182
let node = el.gridstackNode; // use existing placeholder node as it's already in our list with drop location
183+
if (!node) { return false; }
183184
const _id = node._id;
184185
this.engine.cleanupNode(node); // removes all internal _xyz values (including the _id so add that back)
185186
node._id = _id;

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ export class GridStack {
11291129
// check for css min height
11301130
let cssMinHeight = parseInt(getComputedStyle(this.el)['min-height']);
11311131
if (cssMinHeight > 0) {
1132-
let minRow = Math.round(cssMinHeight / this.getCellHeight(true));
1132+
let minRow = Math.round(cssMinHeight / this.getCellHeight(true));
11331133
if (row < minRow) {
11341134
row = minRow;
11351135
}

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class Utils {
7676
if (els[0] === '#') {
7777
return document.getElementById(els.substring(1));
7878
}
79-
if (els[0] === '.') {
79+
if (els[0] === '.' || els[0] === '[') {
8080
return document.querySelector(els);
8181
}
8282

0 commit comments

Comments
 (0)