Skip to content

Commit

Permalink
Merge pull request #892 from radiolips/bugfix/891
Browse files Browse the repository at this point in the history
Don't access `scrollEl` until it's been checked for `null`. Fixes #891.
  • Loading branch information
radiolips committed May 22, 2018
2 parents c25773a + 8cefcb0 commit d46ba76
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/gridstack.all.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/gridstack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* gridstack.js 0.4.0
* gridstack.js 1.0.0-dev
* http://troolee.github.io/gridstack.js/
* (c) 2014-2018 Pavel Reznikov, Dylan Weiss
* gridstack.js may be freely distributed under the MIT license.
Expand Down Expand Up @@ -150,8 +150,8 @@
var offsetDiffDown = rect.bottom - innerHeightOrClientHeight;
var offsetDiffUp = rect.top;
var scrollEl = Utils.getScrollParent(el);
var prevScroll = scrollEl.scrollTop;
if (scrollEl != null) {
var prevScroll = scrollEl.scrollTop;
if (rect.top < 0 && distance < 0) {
// moving up
if (el.offsetHeight > innerHeightOrClientHeight) {
Expand Down Expand Up @@ -1171,6 +1171,8 @@
self._updateContainerHeight();

node._temporaryRemoved = true;
} else {
return;
}
} else {
self._clearRemovingTimeout(el);
Expand Down
2 changes: 1 addition & 1 deletion dist/gridstack.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gridstack.min.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Change log

## v0.1.0 (development)

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

## v0.4.0
Expand Down
2 changes: 1 addition & 1 deletion src/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@
var offsetDiffDown = rect.bottom - innerHeightOrClientHeight;
var offsetDiffUp = rect.top;
var scrollEl = Utils.getScrollParent(el);
var prevScroll = scrollEl.scrollTop;
if (scrollEl != null) {
var prevScroll = scrollEl.scrollTop;
if (rect.top < 0 && distance < 0) {
// moving up
if (el.offsetHeight > innerHeightOrClientHeight) {
Expand Down

0 comments on commit d46ba76

Please sign in to comment.