var h = document.documentElement,
matches = h.matches || h.matchesSelector || h.webkitMatchesSelector || h.oMatchesSelector || h.mozMatchesSelector || h.msMatchesSelector || function(selector) {
var elems = this.parentNode.querySelectorAll(selector), i;
for(i=0; i<elems.length; i++) if(elems[i] === this) return true;
};
document.onclick = function(e) {
if(!matches.call(e.target, '.list, .list div')) {
//Скрываем элемент
}
};