What is a JavaScript framework? How can it be called a framework ?, Javascript framework
When I first started JavaScript, I always heard about the framework. After learning JQ, I will know what the framework is. Here is a reprinted article, hoping to help confused kids shoes.
What is a JavaScript framework?
JavaScript itself is a powerful language that allows you to create rich Internet applications (RIA) without additional frameworks ). However, using JavaScript is not easy, mainly because of the complexity of supporting multiple Web browsers. Like HTML and CSS, different browsers have different JavaScript implementations. Implementing cross-browser compatibility with JavaScript code is a nightmare.
A JavaScript framework or library is a set of tools and functions that can easily generate cross-browser compatible JavaScript code. Each database is reliably tested in modern versions of popular Web browsers. Therefore, you can use these frameworks with confidence, your JavaScript-based RIA will work in a similar way on different browsers and platforms.
In addition to cross-browser solutions, the JavaScript framework makes it easier to write code for retrieving, traversing, and operating DOM elements. They not only provide shortcuts for obtaining DOM element references, but also allow DOM traversal functions to search for any depth of parent, child, and sibling elements in daisy-chaining mode. Finally, the framework also provides a series of functions to operate on these objects more easily, which can be used to change, add, or delete the content itself, or use CSS style classes to change the appearance of elements.
Another important feature of the Framework is its improved event processing support. Because different browsers have different implementation methods, cross-browser event processing will be very difficult. Therefore, JavaScript frameworks usually encapsulate browser events and provide a set of useful cross-browser compatible functions for processing. Some frameworks also provide a set of standard keyboard code to represent keyboard-based events (such as pressing the Escape key, Return key, cursor key, and so on ).
All of these features are very useful, but a feature of the JavaScript framework is very important for its recent popularity-supporting Ajax. Like many other aspects of JavaScript, each Web browser often supports Ajax in different ways, which makes it complicated to process Ajax in a way that is supported by all Web browsers. Almost all JavaScript frameworks include some form of Ajax library support. Generally, Ajax requests and response objects are provided, as well as help functions (helper) used to evaluate responses, update DOM elements, and query specific requests ).
Typical features of JavaScript frameworks
Now let's take a look at the useful features of most JavaScript frameworks. Including:
1. Selector)
2. DOM Traversal
3. DOM operations
4. Utility Functions
5. Event Processing Ajax
When interpreting each feature, I will illustrate it with one or more of the following JavaScript frameworks: Prototype, jQuery, YUI, ExtJS, and MooTools. Although the implementation and syntax of each framework are different, the concepts are the same. Each Framework provides a detailed API reference to help you understand how to use the features in a specific library.