Plan to complete this note in the following order:
1. Philosophy.
2. Attribute copying and inheritance.
3. This/call/apply.
4. Closure/getter/setter.
5. prototype.
6. Object-oriented simulation.
7. The basic mechanism of jquery.
8. jquery Selector.
9. jquery Tool method.
Jquery-expands at the "class" level.
Jquery-is expanded at the "object" level.
jquery-extension Selector.
JQuery UI.
14. Extend the jquery UI.
This is the 8th of the notes and a chat about the jquery selector.
I've been busy at work recently and haven't updated my notes for a few days.
It's time to calm down and write something today.
Claw machine offline, all by memory, today's notes no code.
Fortunately for jquery selectors, the need to understand their principles is not particularly large, unless you need to implement similar functions, or you need to extend the jquery selector.
Topic 1: Four types of selectors
is actually the four parameter types that pass in the $ () function, respectively:
* DOM object, the recognition method is a NodeType property.
* String: String words in two cases, there may be a CSS selector expression, there are several regular expression matching, or possibly an HTML string.
* Array, this, is not only jquery itself clone,pushstack when used like this?
* function, which is the usual $ (function () {/* My code here */}).
How does the Topic 2:jquery store the objects that are found?
Using this[0],this[1] This way, it can be understood that the internal storage structure is an array.
How is the Topic 3:find method implemented?
Before looking at the source code, I also think this is good magic, the browser should only provide Document.getelementbyid/name/tag and so on. Have always guessed that jquery and browser vendors have a leg, looking back, it is unlikely, not with every browser vendor has a leg.
Look at the source, found that: really is on the basis of document.getelementbyid/name/tag with a reasonable algorithm to achieve.
"Silly" approach is not silly, others are still hesitant to do, people have already made it.
Roughly in two steps, first positioning, narrowing down the range, and then filtering.
All right, let's get here today.
Java Programmer's JavaScript learning Note (8--jquery selector)