Sizzle.find = function (expr, context, isxml) {var set, I, Len, match, type, left;//expr whether null if (!expr) {return [];} for (i = 0, len = Expr.order.length; i < Len; i++) {type = expr.order[i];//based on Expr.order, four types of Sizzle.selectors.order : id,class,name,tag//and Leftmatch determine the type of expr if (match = expr.leftmatch[type].exec (expr)) {//left is officially said to determine if the expression after it has been escaped ,//People think the left here is basically meaningless left = Match[1];match.splice (1, 1); if (Left.substr (left.length-1)!== "\ \") {//to match[1] Secondary conversions, such as \: Escaped as:, \. Convert to. match[1] = (Match[1] | | ""). Replace (Rbackslash, "");//Call different find methods for different types, return query results, corresponding element collection set = expr.find[type] (match, context, isxml);//Query knot If the result is not empty, then delete the already-queried expression if (set! = null) {expr = Expr.replace (expr.match[type], ""); break;}}} If the result is empty, then look for if (!set) {set = typeof context.getelementsbytagname!== "undefined" in the following way: Context.getelementsbytagname ( "*" ) :[];} Returns the temporary result return {set:set, expr:expr};};
JQuery sizzle.find [Source analysis]