From dcabd3260c86def829869380215bb0a0ca8c0f42 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Sun, 14 Feb 2016 14:40:59 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20refactor=20getValueGetter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/isotope.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/js/isotope.js b/js/isotope.js index 0a4c94a..7a3621e 100644 --- a/js/isotope.js +++ b/js/isotope.js @@ -370,20 +370,18 @@ var trim = String.prototype.trim ? // get an attribute getter, or get text of the querySelector function getValueGetter( attr, query ) { - var getValue; // if query looks like [foo-bar], get attribute if ( attr ) { - getValue = function( elem ) { + return function getAttribute( elem ) { return elem.getAttribute( attr ); }; - } else { - // otherwise, assume its a querySelector, and get its text - getValue = function( elem ) { - var child = elem.querySelector( query ); - return child && child.textContent; - }; } - return getValue; + + // otherwise, assume its a querySelector, and get its text + return function getChildText( elem ) { + var child = elem.querySelector( query ); + return child && child.textContent; + }; } return mungeSorter;