From fe0742dc40f3166300878b309dbd09059cbe4225 Mon Sep 17 00:00:00 2001 From: Larry Davis Date: Tue, 25 Aug 2015 10:08:41 -0700 Subject: [PATCH] Make sure the computed style is truthy before dereferencing it, fixes #16 --- inobounce.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inobounce.js b/inobounce.js index 73c9112..cecb8b5 100644 --- a/inobounce.js +++ b/inobounce.js @@ -16,6 +16,12 @@ while (el !== document.body) { // Get some style properties var style = window.getComputedStyle(el); + + if (!style) { + // If we've encountered an element we can't compute the style for, get out + break; + } + var scrolling = style.getPropertyValue('-webkit-overflow-scrolling'); var overflowY = style.getPropertyValue('overflow-y'); var height = parseInt(style.getPropertyValue('height'), 10);