Home > Web Front-end > JS Tutorial > JQuery 1.6 released with performance improvements and a lot of breaking changes_jquery

JQuery 1.6 released with performance improvements and a lot of breaking changes_jquery

WBOY
Release: 2016-05-16 18:06:53
Original
1000 people have browsed it

Some important improvements in the new version:

  • attr(), val() and data() Methods have better performance;
  • Support Boolean attributes in attr() method;
  • Added hook function to allow extension of attr() and val() methods;
  • map() method adds support for objects (maps properties of JavaScript objects to functions)
  • Allows updating CSS using relative values ​​("=", "-=");
  • Added deferred.always(), deferred.pipe() methods, reducing the amount of code and improving code readability;
  • Synchronized Animations – All animations are now synced to the same time interval. Animations are also smoother with new browser features;
  • find(), closest() and is() Can accept all DOM elements and JQuery objects as parameters.

All these new features along with the entire list of bug fixes are detailed in the official blog post.

Unfortunately, this contains some breaking changes, and the team has highlighted them with a separate chapter in the official update:

变更 JQuery 1.5.2 示例 JQuery 1.6 示例
data()方法使用破折号创建驼峰格式。
data-max-value="15" 创建{ max-value: 15 } data-max-value="15" 创建{ maxValue: 15 }
区分了Property与Attribute。attr()方法现在不能用于获取preperty的值。为了处理property的值,引入了prop()和removeProp()方法。 如果复选框被选中,checkbox.attr("checked")返回(true)



 
checkbox.attr("checked")返回空字符串。
要判别是否选中,需在事件处理程序中使用
$(this).prop("checked")或
$(this).is(":checked")。

If nothing else, the second change will affect existing projects that plan to upgrade to 1.6.

This version was launched 3 months after the release of 1.5 and 1 month after the release of 1.5.2. Work on 1.7 has already begun, and the JQuery team has accepted the feature proposal.

JQuery is a JavaScript library for rapid web development that simplifies HTML document traversal, event handling, animation, and Ajax interaction.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template