From a52e55228a58041cdc143da6ecbb413c9bfc8a16 Mon Sep 17 00:00:00 2001 From: Michael Cordingley Date: Mon, 2 Dec 2013 14:32:32 -0500 Subject: [PATCH] Support IE8 StackOverflow question with pertinent details: http://stackoverflow.com/questions/3199588/fastest-way-to-convert-javascript-nodelist-to-array --- src/echo.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/echo.js b/src/echo.js index a3bd0b3..ff60607 100644 --- a/src/echo.js +++ b/src/echo.js @@ -2,7 +2,7 @@ window.Echo = (function (window, document, undefined) { 'use strict'; - var store; + var store = []; var _inView = function (img) { var coords = img.getBoundingClientRect(); @@ -19,7 +19,9 @@ window.Echo = (function (window, document, undefined) { }; var init = function () { - store = Array.prototype.slice.call(document.querySelectorAll('[data-echo]')); + var nodes = document.querySelectorAll('[data-echo]'); + for (var i = nodes.length; i--; store.unshift(nodes[i])); + _pollImages(); window.onscroll = _pollImages; };