惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
J
Java Code Geeks
有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
Apple Machine Learning Research
Apple Machine Learning Research
量子位
D
Docker
V
Visual Studio Blog
博客园 - 司徒正美
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
U
Unit 42
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
V
V2EX
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
Vercel News
Vercel News
C
Check Point Blog

博客园 - leavingme

从 Google Code 迁移代码到 GitHub 上 ActionScript 3 Socket 安装 VirtualBox Guest Additions 后 Windows XP 分辨率问题 Xcode 4.5的几个问题 Function Backbone.js WebGL 关闭脚本运行慢的提示 理解使用 JavaScript 构建 Metro 应用 iOS RSA相关资料 CommonJS 网站地图 Apache Ant & YUI Builder html5 manifest ie6下动态更改img.src 图片不显示 ApacheBench 锚点 空白的iframe 中文正则
Relearn jQuery
leavingme · 2012-03-25 · via 博客园 - leavingme

好久都没有关注jQuery了,趁着这次 1.7.2 的发布,学点新东西

http://api.jquery.com/category/version/1.7/

1.7 带来的改变

Event APIs: .on() and .off()

统一并代替了.bind() 和 .delegate() 方法,下面是新老API的比较

$('a').bind('click', myHandler);
$('a').on('click', myHandler);

$('form').bind('submit', { val: 42 }, fn);
$('form').on('submit', { val: 42 }, fn);

$(window).unbind('scroll.myPlugin');
$(window).off('scroll.myPlugin');

$('.comment').delegate('a.add', 'click', addNew);
$('.comment').on('click', 'a.add', addNew);

$('.dialog').undelegate('a', 'click.myDlg');
$('.dialog').off('click.myDlg', 'a');

$('a').live('click', fn);
$(document).on('click', 'a', fn);

$('a').die('click');
$(document).off('click', 'a');

Better Support for HTML5 in IE6/7/8
jQuery.Callbacks()
Toggling Animations Work Intuitively