Skip to content

Commit

Permalink
Merge pull request #1365 from JohnnP/patch-15
Browse files Browse the repository at this point in the history
Correction when domNode is null
  • Loading branch information
fconstantin authored Apr 6, 2017
2 parents 7412740 + 33a85c1 commit 8c46cd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/behaviours/scroll/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isUndefined} from 'lodash/lang';
import {isUndefined, isNull} from 'lodash/lang';

const Scroll = Component => class ScrollComponent extends Component {
constructor(props) {
Expand All @@ -16,7 +16,7 @@ const Scroll = Component => class ScrollComponent extends Component {
scrollPosition(domNode) {
const y = window.pageYOffset || document.documentElement.scrollTop;
const x = window.pageXOffset || document.documentElement.scrollLeft;
if(isUndefined(domNode)) {
if(isUndefined(domNode) || isNull(domNode)) {
return { top: y, left: x };
}
const nodeRect = domNode.getBoundingClientRect();
Expand Down

0 comments on commit 8c46cd5

Please sign in to comment.