switch(tagName){
case "span":
node = element.parent().parent();
element = element;
break;
case "td":
node = element.parent();
element = element .find("span");
break;
default:
node = element;
break;
}
The above statement is equivalent to
if(tagName == " span"){
node = element.parent().parent();
element = element;
}else if(tagName == "td"){
node = element.parent( );
element = element.find("span");
}else{
node = element;
}
After paying attention to each case, be sure to Add: break;
default, which is equivalent to else