Java programmer's JavaScript learning notes (8 -- jQuery selector)

Source: Internet
Author: User

Java programmer's JavaScript learning notes (8 -- jQuery selector)

We plan to complete this note in the following order:

1. concept.
2. Copy and inherit attributes.
3. this/call/apply.
4. Closure/getter/setter.
5. prototype.
6. object-oriented simulation.
7. Basic jQuery mechanism.
8. jQuery selector.
9. jQuery tool method.
10. jQuery-extension at the class level.
11. jQuery-extensions at the "object" level.
12. jQuery-extended selector.
13. jQuery UI.
14. Extend the jQuery UI.

This is Part 1 of the notes. Let's talk about jQuery's selector.

 

 

 

My work has been very busy recently. I haven't updated my notes for a few days.
Finally, today, I have been able to write something quietly.
The claw machine is offline and it depends on its memory. Today's note has no code.
Fortunately, you can use the jQuery selector skillfully. It is not necessary to understand the principle unless you need to implement similar functions or extend the jQuery selector.

Topic 1: four types of Selector
It is actually the four types of parameters passed into the $ () function, which are:
* Dom object, which is identified by the nodeType attribute.
* String: A string can be a css selector expression that matches several regular expressions or an html string.
* Array. Is this only applicable to jQuery clone and pushStack?
* Function, commonly used $ (function () {/* my code here */}).

Topic 2: How does jQuery store the found objects?
Using this [0], this [1], we can understand that the internal storage structure is an array.

Topic 3: How is the find method implemented?
Before reading the source code, I think this is amazing. the browser should only provide document. getElementById/Name/Tag and so on. I have always guessed that jQuery and browser vendors have a leg. Looking back, it is impossible to have a leg with every browser vendor.
After reading the source code, we found that the algorithm is actually implemented based on document. getElementById/Name/Tag.
The "silly" method is not silly. when others are still hesitating to do it, they have already made it.
It can be roughly divided into two steps: first positioning, narrowing down the scope, and then filtering.

Now, let's get here today.

Related Article

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.