这些代码看不懂什么意思?
function parentsUntil(elem, filter) {
var matched = [],
until,
truncate = filter !== undefined;
while ((elem = elem['parentNode']) && elem.nodeType !== 9) {
if (elem.nodeType === 1) {
if (truncate) {
if(elem.nodeName.toLowerCase() ==filter){
break;
}
}
matched.push(elem);
}
}
return matched;
}