hasClass(className):判断匹配的元素是否含某个类
@param (string) className;
@return (boolean)
1 var className = " " + selector + " ", 2 i = 0, 3 l = this.length; 4 for ( ; i < l; i++ ) { 5 /* 6 1.最关键是使用到indexOf 7 */ 8 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { 9 return true; 10 } 11 } 12 13 return false;