JQuery Sizzle. find [Source Code Analysis]
Sizzle. find = function (expr, context, isXML) {var set, I, len, match, type, left; // whether expr is null if (! Expr) {return [];} for (I = 0, len = Expr. order. length; I <len; I ++) {type = Expr. order [I]; // according to Expr. order, that is, Sizzle. selectors. four types of order: ID, CLASS, NAME, TAG // determine the expr type with leftMatch if (match = Expr. leftMatch [type cmd.exe c (expr) {// left is officially used to determine whether the subsequent expressions are escaped, // The person thinks that the left here basically has no meaning left = match [1]; match. splice (1, 1); if (left. substr (left. length-1 )! = "\") {// Re-convert match [1], for example, \: escape :,\. convert. match [1] = (match [1] | ""). replace (rBackslash, ""); // call different find methods for different types and return the query results. The corresponding element set = Expr. find [type] (match, context, isXML); // if the query result is not empty, delete the query expression if (set! = Null) {expr = expr. replace (Expr. match [type], ""); break ;}}// if the result is null, search for if (! Set) {set = typeof context. getElementsByTagName! = "Undefined "? Context. getElementsByTagName ("*"): [] ;}// return the temporary result return {set: set, expr: expr };};