From c77fc689b51c734f7a2045bfe08be75221a894dc Mon Sep 17 00:00:00 2001 From: Valentin Zwick Date: Sun, 6 Apr 2014 22:36:03 +0200 Subject: [PATCH] Query for `` elements only While this is probably a case of micro-optimisation, [there is a performance gain of some 5%](http://jsperf.com/queryselectorall-with-attr-only-and-with-element-type) when querying for `img[data-echo]` as opposed to `[data-echo]` only. --- src/echo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/echo.js b/src/echo.js index ce86a45..3399e13 100644 --- a/src/echo.js +++ b/src/echo.js @@ -76,7 +76,7 @@ window.Echo = (function (global, document, undefined) { */ var init = function (obj) { - var nodes = document.querySelectorAll('[data-echo]'); + var nodes = document.querySelectorAll('img[data-echo]'); var opts = obj || {}; offset = parseInt(opts.offset || 0); throttle = parseInt(opts.throttle || 250);