I'm new to web development, I'm discovering javascript and all its capabilities. I'm currently learning jQuery and it made me wonder: "what really is a library ?".
From some so/internet search I understand that jQuery is a library, although some people also consider it a framework as it help/force you to change the way you code js.
For me, a library is a set of functions and classes to help the programmers on a particular point.
As I understand it jQuery doesn't seem to only add function or classes contrary to other javascript libraries such as math, for example or even other jQuery plugins like datatables etc...
To me, jQuery at its base just looks like another way of presenting js code.
So to summarise my questions are:
- Is jQuery a "normal" library like Math for c++, python or even js?
- How does the js engine understand jQuery? (some sort of compilation ?)
- Can every js engine understand jQuery as long as they have the jQuery.js file, or is there something already embedded inside the engine for jQuery.
I also took a look at this very interesting so post on Is a jQuery compiler possible?, but it just blurred me the line between library and jQuery even more.
Any hint or link to how js/jquery combine would be helpful!
Yes. It's just a collection of functions, etc.
jQuery is just code written in JavaScript using the standard features of the browser (the DOM, etc.). (Well, and some non-standard ones it feature-tests for to get around browser idiosyncracies.)
jQuery is designed for the browser environment, so it won't work correctly in a non-browser environment without additional dependencies (a DOM library, etc.).
For the avoidance of doubt: There's nothing you can do with jQuery that you can't do without jQuery, using JavaScript's standard library, the DOM API, and other browser APIs directly. All jQuery does is provide an alternate API for doing DOM manipulation, provide some utility functions, and define a standard way to add features to extend jQuery with more functionality (e.g., "jQuery plugins").
And for completeness: