var estimateHeight = function( target ){
console.log( "Estimate Height : ", target );
var total = 0;
if( typeof target === "string" ){
console.log( "Estimate Height : SELECTOR : " );
total = estimateHeight( document.querySelectorAll( target ) );
}
if( target instanceof HTMLElement ){
console.log( "Estimate Height : ELEMENT : " );
total = target.offsetHeight;
} else if( target instanceof NodeList ){
console.log( "Estimate Height : NODELIST : " );
for( var i = 0; i < target.length; i++ ){
total += estimateHeight( target[i] );
}
} else if( Array.isArray( target ) ){
console.log( "Estimate Height : Array<SELECTOR> : " );
total = target.reduce((total,current)=>{
total = total || 0;
total += estimateHeight( current );
return total;
},0);
}
console.log( "Total => ", total );
return total
};