how this library can span all the complex Javascript language (functions, methods etc.)
Simple, she doesn’t do this.
The text seems to indicate that you think jQuery replaces Javascript, when in fact it’s just a set of functions like any other. In the background are only utilitarian functions that make the bulk of the work within it and let you just pass the parameters, ie fill the gaps, which is exactly why we create functions.
Functions exist as abstractions for algorithms that will be used in the code. It is the mechanism of Pattern design most important of the programming. You take a situation that repeats itself, or at least is clearly a characterized responsibility, and reuse it whenever you need it without worrying about the details, and this is the best form of reuse that exists (it’s not OOP as many think).
The function is the best mechanism to get DRY. And the goal of jQuery is to decrease the repetition of tasks that everyone does in JS several times. You just parameterize what you want.
So the library doesn’t do anything revolutionary, it just gives you some ready-made patterns.
Actually it is very simple. Perhaps the most sophisticated mechanism is the use of anonymous functions to parameterize actions that must be executed within the jQuery function.
Obviously, the people who did it know how to program and can repurpose code, compose everything they need efficiently as far as possible. Today it is very common to see codes out there that are repetitions and repetitions of things already existing in the code itself that the person wrote, sometimes on the same day. This isn’t programming, it’s just creating code.
It is curious that adding the jQuery and the code of the person usually gets bigger than the pure JS :) And is much slower.
You can see the source code here and here.
– Renan Gomes
A little more: What’s the difference between Javascript and jQuery?
– Marconi