Differences between Ext. Get () and Ext. Fly ()

Source: Internet
Author: User

Due to the fly operating principle, we cannot save the fly returned results in variables for reuse, because each fly operation may change the DOM orientation of the variable. See the followingCodeIs incorrect:

VaR my_id = ext. Fly ('My _ id ');
Ext. Fly ('another _ id'); // The DOM reference of my_id has changed to another_id.
My_id.highlight ('ff000000', {// The operation here will be an operation on the another_id Element
Endcolor: '0000ff', Duration: 3
});

Ext. get and ext. fly returns an element object, but Ext. get returns an independent element and has its own independent operation interface encapsulation. It can save the returned value to the variable for future call operations, which makes reuse easier. However, one of its major drawbacks is memory consumption. If Ext. Get (ID) is called 1000 times, 1000 independent elements will be created in the memory. However, in many cases, we may only execute a very simple operation on the DOM element, so if we create an independent element every time and put it in the memory, it is a huge waste of memory, therefore, when we only need to perform one operation or a very simple operation, we use Ext. get seems unreasonable. Ext. Fly is designed to solve this problem. It saves memory by enabling a set of Operation interfaces in the shared memory of each created element.

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.