jquery_2.1.0_ Diary 5.8 Sizzle Selector (iv)

Source: Internet
Author: User

Key steps for Sizzle (selector, context, results, seed)1, the context of the incoming context and the current document is consistent, inconsistent call setdocument () re-set the document for the case of frame.2, if context is empty fix context for document3,selector If it is not a string or the context is not an element or document directly returns an empty array.4, if the document is HTML and does not pass in the filtered result set seed, try the native method getElementById, getElementsByTagName, Getelementsbyclassname, Queryselectorall method Find Element5, other cases, call the Select (Selector, context, results, Seed) method to find the element
here to detail decomposition is the setdocument () method, it is very long, it mainly does the following things1, set the document for the current code run environment (this document is not the document, it is a normal variable that references the document in the current window).2, to deal with getElementById, getElementsByTagName, getelementsbyclassname different browser differences, for different viewers set expr.find[' ID ',expr.filter[' ID ']a unified approach to performance3, dealing with QSA's bizarre behavior4. Set the Sort method for document5, returns the current document

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.