Dojo framework: misunderstanding and reality

Source: Internet
Author: User

With the popularity of Ajax technology, more and more web applications use Ajax technology to improve user experience. An important advantage of using Ajax technology is that it does not require additional browser plug-ins. You only need to use the native API of the browser and use JavaScript to perform operations. Two major problems encountered when using native APIs are browser compatibility and programming complexity brought about by the underlying a-Pi interface. The implementation of the same function varies with browsers. If an application wants to support different browsers, developers need to add a lot of browser detection or sniffingCode. For example, the same event binding function uses attachevent on IE, and addeventlistener on other browsers. In addition to compatibility issues, the native API interfaces provided by the browser are generally suitable for fine-grained operations. When you need to complete some relatively complex operations, using the native API will make the code cumbersome. Take a DOM query as an example: in the current document tree, find the direct subnodes of all given labels of nodes with a given ID. For such a query, if you use the native dom api, you need to use getelementbyid to find the node, and use childnodes to obtain the subnode list and compare the node label names. The number of required codes is relatively large.

The emergence of the Javascript framework aims to solve these two major problems, and different JavaScript frameworks also provide additional values. Currently, many JavaScript frameworks are available, and more than a dozen are popular. These popular JavaScript frameworks include jquery, dojo, Yui, mootools, prototype, ext JS, and Google closure. These different frameworks have different advantages and disadvantages, and have different application scenarios and scopes. Due to my work, I have the most use of the dojo framework and have some knowledge about other frameworks. This article aims to clarify some misunderstandings about the dojo framework and help developers select the appropriate framework.

Before getting started, we will briefly introduce the basic structure of the dojo framework. The dojo framework consists of four parts: the Basic dojo library, core library, dijit, and extension library. The basic library contains the most basic functions. The core library is the extension of the basic library, dijit is the user interface library, and the extension library is a variety of extension components.

Meet Basic Ajax application development needs

Like other frameworks, Dojo tries to meet the most basic requirements in Ajax application development. These basic requirements include the browser compatibility and the interface granularity of native APIs mentioned above, as well as some typical application scenarios. Specifically, it should include the following functional sets: javascript language enhancement, XMLHttpRequest encapsulation, Dom query and operation, and event processing. Browser compatibility shows that these feature sets have the same effect on different browsers.

The dojo framework provides a wide range of support for these feature sets. In JavaScript language enhancements, there are many enhancements to numbers, strings, date types, arrays, and Javascript methods. In addition to common XMLHttpRequest, IFRAME and

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.