var arr1 = [
{date:"2015-01-22", dog:1},
{date:"2015-01-22", cat:2},
{date:"2015-01-22", duck:3},
{date:"2015-01-22", duck:2},
{date:"2015-01-22", cat:3},
{date:"2015-01-22", dog:4}
],
arr2 = [];
for (var i = 0; i < arr1.length; i += 1) {
if (arr2[arr1[i].date] && arr2[arr1[i].date].date) {
for (n in arr1[i]) {
if (n !== 'date') {
arr2[arr1[i].date][n] = (arr2[arr1[i].date][n]) ? arr2[arr1[i].date][n] + arr1[i][n] : arr1[i][n];
}
}
} else {
arr2[arr1[i].date] = arr1[i];
}
}
console.log(arr2);
document.addEventListener('click', function (event) {
var selectors = document.querySelectorAll('____СЕЛЕКТОР____'),
element = event.target,
index = -1;
if (selectors) {
while (element && ((index = Array.prototype.indexOf.call(selectors, element)) === -1)) {
element = element.parentElement;
}
if (index > -1) {
(function () {
//РЕЗУЛЬТАТ СЮДА
}).call(element, event);
}
}
});