yurii_Kh,
алгоритмов можно придумать много ...
calendar.onclick = function(event) {
var target = event.target;
while (target != this) {
if (target.classList.contains('calendar-day')) {
highlight(target);
target.appendChild(div);
break;
}
if (target.classList.contains('add-event-wrap')) {
break;
}
target = target.parentNode;
}
};