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

Skip to content

Commit 8cefcb0

Browse files
committed
Don't access scrollEl until it's been checked for null. Fixes gridstack#891.
1 parent 182c71c commit 8cefcb0

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

dist/gridstack.all.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gridstack.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* gridstack.js 0.4.0
2+
* gridstack.js 1.0.0-dev
33
* http://troolee.github.io/gridstack.js/
44
* (c) 2014-2018 Pavel Reznikov, Dylan Weiss
55
* gridstack.js may be freely distributed under the MIT license.
@@ -150,8 +150,8 @@
150150
var offsetDiffDown = rect.bottom - innerHeightOrClientHeight;
151151
var offsetDiffUp = rect.top;
152152
var scrollEl = Utils.getScrollParent(el);
153-
var prevScroll = scrollEl.scrollTop;
154153
if (scrollEl != null) {
154+
var prevScroll = scrollEl.scrollTop;
155155
if (rect.top < 0 && distance < 0) {
156156
// moving up
157157
if (el.offsetHeight > innerHeightOrClientHeight) {
@@ -1171,6 +1171,8 @@
11711171
self._updateContainerHeight();
11721172

11731173
node._temporaryRemoved = true;
1174+
} else {
1175+
return;
11741176
}
11751177
} else {
11761178
self._clearRemovingTimeout(el);

dist/gridstack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gridstack.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Change log
2121

2222
## v0.1.0 (development)
2323

24+
- don't throw error if no bounding scroll element is found ([#891](https://github.com/troolee/gridstack.js/issues/891)).
2425
- don't push locked widgets even if they are at the top of the grid ([#882](https://github.com/troolee/gridstack.js/issues/882)).
2526

2627
## v0.4.0

src/gridstack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@
150150
var offsetDiffDown = rect.bottom - innerHeightOrClientHeight;
151151
var offsetDiffUp = rect.top;
152152
var scrollEl = Utils.getScrollParent(el);
153-
var prevScroll = scrollEl.scrollTop;
154153
if (scrollEl != null) {
154+
var prevScroll = scrollEl.scrollTop;
155155
if (rect.top < 0 && distance < 0) {
156156
// moving up
157157
if (el.offsetHeight > innerHeightOrClientHeight) {

0 commit comments

Comments
 (0)