Browse Source

🛠 refactor getValueGetter

pull/1127/head
David DeSandro 9 years ago
parent
commit
dcabd3260c
  1. 10
      js/isotope.js

10
js/isotope.js

@ -370,21 +370,19 @@ var trim = String.prototype.trim ?
// get an attribute getter, or get text of the querySelector // get an attribute getter, or get text of the querySelector
function getValueGetter( attr, query ) { function getValueGetter( attr, query ) {
var getValue;
// if query looks like [foo-bar], get attribute // if query looks like [foo-bar], get attribute
if ( attr ) { if ( attr ) {
getValue = function( elem ) { return function getAttribute( elem ) {
return elem.getAttribute( attr ); return elem.getAttribute( attr );
}; };
} else { }
// otherwise, assume its a querySelector, and get its text // otherwise, assume its a querySelector, and get its text
getValue = function( elem ) { return function getChildText( elem ) {
var child = elem.querySelector( query ); var child = elem.querySelector( query );
return child && child.textContent; return child && child.textContent;
}; };
} }
return getValue;
}
return mungeSorter; return mungeSorter;
})(); })();

Loading…
Cancel
Save