JQuery sizzle.find [Source analysis]

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.