Browse Source

handle case when options.domElement is null

pull/30/head
Nikolaus Piccolotto 11 years ago
parent
commit
b174467dd6
  1. 4
      src/echo.js

4
src/echo.js

@ -29,8 +29,8 @@ window.Echo = (function (window, document, undefined) {
var opts = obj || {}; var opts = obj || {};
offset = opts.offset || 0; offset = opts.offset || 0;
throttle = opts.throttle || 250; throttle = opts.throttle || 250;
domElement = opts.domElement ? document.querySelector( opts.domElement ) : window; domElement = opts.domElement ? document.querySelector(opts.domElement) : window;
var nodes = document.querySelectorAll( opts.domElement + ' [data-echo]'); var nodes = document.querySelectorAll( (opts.domElement || "") + ' [data-echo]');
for (var i = 0; i < nodes.length; i++) { for (var i = 0; i < nodes.length; i++) {
store.push(nodes[i]); store.push(nodes[i]);

Loading…
Cancel
Save