function allSibling(ele){
var pre = ele.previousSibling,
nex = ele.nextSibling,
preAry = [],
nexAry = [];
while(pre){
if(pre.nodeType===1){
preAry.unshift(pre);
}else{
pre = pre.previousSibling;
}
}
while(nex){
if(nex.nodeType===1){
nexAry.push(nex);
}else{
nex = nex.nextSibling;
}
}
return preAry.concat(nexAry);
}
//老师让用previousSibling和nextSibling 获取到所有兄弟节点.请大神看看我写的哪里错了?//
聪明的汤姆
相关分类