What is the JavaScript framework? How do you call it a framework?

  • 2020-06-22 23:55:16
  • OfStack

When you first learn js, you always hear about frameworks. I didn't know what a framework was until I finished JQ. The following is a reprint of an article, I hope to still confused children's shoes have a little help.

What is the JavaScript framework?

JavaScript is a powerful language in its own right, and you don't need additional frameworks to create rich Internet applications (RIA). However, using JavaScript has not been easy, mainly due to the complexity of supporting multiple Web browsers. As with HTML and CSS1, different browsers have different implementations of JavaScript. Making JavaScript code cross-browser compatible is a nightmare.

The JavaScript framework or library is a set of tools and functions that can easily generate cross-browser compatible JavaScript code. Each library has been reliably tested on many modern versions of the popular Web browser, so you can rest assured that your ES21En-based RIA will work similarly across browsers and platforms.

In addition to solving the cross-browser problem, the JavaScript framework makes it easier to write code that retrieves, traverses, and manipulates DOM elements. Not only do they provide shortcut functions to get references to DOM elements, but they also allow DOM traversal functions to find parents, children, and siblings at any depth in Daisy chaining (ES29en-ES30en). Finally, the framework provides a series of functions to manipulate these objects more easily, changing, adding, or deleting the content itself; Or use the CSS style class to change the appearance of the element.

Another important feature of the framework is its improved event handling support. Cross-browser event handling can be difficult because different browsers implement it differently. So the JavaScript framework typically encapsulates browser events and provides a useful set of cross-browser compatible functions to handle. Some frameworks also provide a standard set of keyboard codes to represent keyboard-based events (Escape key, Return key, cursor key, and so on).

All of these features are useful, but the JavaScript framework has one feature that is important to its recent popularity - support for Ajax. Like many other aspects of JavaScript, each Web browser tends to support Ajax in a different way, making it 10 minutes more complicated to handle Ajax in a way that is supported in all Web browsers. Almost all JavaScript frameworks include some form of Ajax library support, typically providing Ajax request and response objects, as well as help functions (helper) to evaluate responses, update DOM elements, and query specific requests.

Typical features of the JavaScript framework

Now, let's look at the useful features that most JavaScript frameworks have. Include:

1. Selector (Selector)
2. DOM traversal
3. DOM operation
4. Practical (Utility) functions
5. Event handling Ajax

I will illustrate each feature 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 has a detailed API reference to help you understand how to use the features in that particular library.

Related articles: