Re-optimizing the template engine: Juicer

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

The front-end template engine is popular with webmasters for its code readability and ease of maintenance. There are many template engines on the market, such as: mustache, JQuery Tmpl, Kissy template, Ejs, DoT, Ntenjin, etc. As technology progresses, these template engines are increasingly tailored to the user's experience requirements. At present, there is a new template juicer, since it is a new template, that it must have other templates do not have the new features, let's take a look at the next juicer.

Juicer most attention is its efficient performance, because the user's experience perception, directly affected by it. At the same time, juicer both the error handling mechanism and the security. Let's take a look at the performance comparisons of several major template engines on Jsperf.

  

  

With the above diagram, we can see clearly the advantages of juicer in performance. Here is a detailed introduction to the next juicer.

I. Security

Juicer to the data output security escape, to avoid the execution of malicious JS code. Follows

  

  

If the JSON data is returned by a Third-party interface or contains content from user input (such as BBS, evaluation), the first code will easily execute malicious code. Of course, if you do not want to be escaped, you can use $${varname}.

Ii. Error Handling

Error handling prevents subsequent JS code from being executed when the template engine compiles incorrectly. When Juicer encounters some of the JSON data's occasional errors, it only makes a warning at the console (Warn) to inform the developer that the template parsing error is not affecting the execution of subsequent code.

  

So efficient template engine, are you ready to be ready?

This article by the Zhengzhou wall painting: http://www.zzfeitian.com finishing release.

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.