jQuery 1.2.6 发布信息

姗姗来迟的1.2.6的发布信息,其实本来是1.2.4的,结果扯出点小事来。
这回jq文件97.8K,直逼100K大关啦。估计下个版本就破了。
其实pack版破30也是很早以前的事情了
好了,多的不说了

主要是性能更新,
可以看这里:
http://spreadsheets.google.com/pub?key=pFIHldY_CksyThxfgx6krfA

没有IE6,被无视咯~

事件处理快了103% ——快了很多啊

CSS选择器快了13%——非常好,这个最重要了,越快越好。不过受限于正则的速度。。。是由于jQuery.map() 提升866% 还有 jQuery.extend() 19% 提升速度,所以导致整个都快了

.offset() 21%

.css() 25%

然后是新特性
Dimensions插件彻底融入jquery内核。这个上次已经说过了。

.attr()重写了,解决了15项bug

.toggle() 能接受更多函数了
比如:
$("div").toggle(function(){
$(this).removeClass("three").addClass("one");
}, function(){
$(this).removeClass("one").addClass("two");
}, function(){
$(this).removeClass("two").addClass("three");
});

.index() 支持jQuery集合了
var test = $("div.test");
$("div").index( test ) == 3

jQuery.makeArray可以把任何东西弄成数组了
jQuery.makeArray( document.getElementsByTagName("div") )
// => [ div, div, div ]

jQuery.makeArray( true )
// => [ true ]

jQuery.makeArray()
// => []

beforeSend 能取消Ajax调用了
$.ajax({
beforeSend: function(){
return $("#input").val() == "";
},
url: "test.php"
});

从上面代码上看,就是在beforeSend里,return true,就是取消请求。跟一般的return false不太一样。

动画的速度可以自己设置fast slow normal的值了。
jQuery.fx.speeds.slow = 1000;
$("#test").slideDown("slow");

总体来说,更新就这些了。

《jQuery 1.2.6 发布信息》上有1条评论

回复 Lin.x 取消回复

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据