Browse Source

check for elem & child in getting sort data

pull/563/head
David DeSandro 12 years ago
parent
commit
49b31cebd3
  1. 9
      item.js

9
item.js

@ -1,5 +1,5 @@
/**
* Packery Item Element
* Isotope Item
**/
( function( window ) {
@ -84,11 +84,11 @@ function mungeSorter( sorter ) {
var parser = getParser( args[1] );
// parse the value, if there was a parser
sorter = parser ? function( elem ) {
return parser( getValue( elem ) );
return elem && parser( getValue( elem ) );
} :
// otherwise just return value
function( elem ) {
return getValue( elem );
return elem && getValue( elem );
};
return sorter;
@ -105,7 +105,8 @@ function getValueGetter( attr, query ) {
} else {
// otherwise, assume its a querySelector, and get its text
getValue = function( elem ) {
return getText( elem.querySelector( query ) );
var child = elem.querySelector( query );
return child && getText( child );
};
}
return getValue;

Loading…
Cancel
Save