From b174467dd6eeb18a9b556ec5405c285b277694fe Mon Sep 17 00:00:00 2001 From: Nikolaus Piccolotto Date: Mon, 13 Jan 2014 19:46:22 +0100 Subject: [PATCH] handle case when options.domElement is null --- src/echo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/echo.js b/src/echo.js index 62688ba..9a1bb97 100644 --- a/src/echo.js +++ b/src/echo.js @@ -29,8 +29,8 @@ window.Echo = (function (window, document, undefined) { var opts = obj || {}; offset = opts.offset || 0; throttle = opts.throttle || 250; - domElement = opts.domElement ? document.querySelector( opts.domElement ) : window; - var nodes = document.querySelectorAll( opts.domElement + ' [data-echo]'); + domElement = opts.domElement ? document.querySelector(opts.domElement) : window; + var nodes = document.querySelectorAll( (opts.domElement || "") + ' [data-echo]'); for (var i = 0; i < nodes.length; i++) { store.push(nodes[i]);