[View JavaScript from jQuery]-JavaScript, jquery-javascript
What is JavaScript? I believe Baidu and Google can find a lot of definitions and explanations. In my understanding, JavaScript is a client script language used to process page data logic and user experience (webpage special effects ). In fact, JavaScript is not only used for clients, but also for server-side programming. A typical example is Mozilla Rhino. Mozilla Rhino is an open-source JavaScript Implementation of pure Java. It only compiles and implements the core JavaScript syntax, there are no HTML object processing and other functions (this is not of course ......). The scope of my work is only JavaScript in the browser, so I will not mention it here. If you are interested in Mozilla Rhino, click here. Similar JavaScript Engines include Mozilla SpiderMonkey (implemented in C) and DMDScript (implemented in D.
For the browser-side JavaScript Engine, there are also several categories, such as Microsoft's JScript and Netscape's JavaScript (in other words, netscape is the originator of JS-the author is Netscape's Brendan Eich), Google's V8 (Chrome's JS engine), and Apple's WebKit. So many engines will bring about many different standards, which leads to the dilemma we encounter in front-end Web development-JS is not applicable to every browser. To this end, as early as the beginning of JavaScript, Netscape submitted it to ECMA (European Computer Manufacturers Association) for standardization, so today's JavaScript Engines are basically in compliance with ECMA-262 specifications. Although they all comply with ECMA-262 specifications, vendors have made their own extensions and modifications to their JavaScript Engines. These nonstandard extensions and modifications eventually led to a strong integration requirement, so one JS function library emerged, and jQuery was one of them.
As mentioned above, JavaScript is a scripting language that does not need to be compiled on the server, but is interpreted and executed by the browser after being sent to the client. Therefore, it is an interpreted language. For the interpreter language, the source code is read and executed. When an error occurs during execution, all scripts after the error statement will be stopped. Moreover, the browser does not retain the running results, so every time you open the same page, the JS on the page will run again (although the source file can be cached by setting the header information ), this is an inherent performance issue of JS. It should also be noted that when the browser interprets the HTML document, the introduction of JS is also interpreted in order. Therefore, if the introduced JS scripts are dependent on each other, the statements that execute the dependent methods must follow the implementation of the method statements. In addition, the DOM generation sequence of various browsers is also different, so if JavaScript scripts to be executed need to call DOM objects, it is best to put them in functions such as onload. For functions directly written on the page, you can also add the defer attribute on the introduced tag (supported by IE5, FF3.5 or a later version) to suspend the execution. In addition, it is best to include the JS scripts directly written on the page! -And //->. This is used to prevent lower-version browsers from incorrectly interpreting code.
We have mentioned the historical background of the emergence of JS function libraries. What are these functions actually doing? As the name suggests, they integrate the implementation functions of various common functions, and handle the differences in various browsers, refined and smart. Next, let's start to experience the JavaScript scripting language from the source code of the jQuery function library!
Is JQuery different from JavaScript?
First, JQuery is written in Javascript,
It can also be said that JQuery is a Javascript Application.
However, once you use JQuery, your script is very different.
In addition, the content written by Javascript only has a structure view of "attribute,
However, there is no "programming idea" structure concept, which is also defined by you.
JQuery wraps the entire webpage in the DOM architecture.
You can edit all objects in the text directly (you do not need to declare a lot of objects first)
Search for "Javascript with json ajax" and "JQuery with json ajax" on the Internet"
We will see the length of the upstream number in the writing method, and compare it with the structural differences.
Learning to use jquery without javascript is feasible?
This is acceptable. When I learned web development, the teacher handed in jquery directly. Later, I saw the javascript code and felt that jquery was much simpler than it. Javascript can be left blank and can be understood. Jquery is encapsulated and extracted from javascript. You just need to know how to use it. There is no need to understand its internal structure. Just as we will use the C ++ function library, but do not necessarily know the experiment method of the function we call, we only need to know how to pass parameters. This is a truth.