matsukaz's blog

Agile, node.js, ruby, AWS, cocos2d-xなどなどいろいろやってます

jQuery 1.2.2リリース

$(DOMElement)の処理が300%高速化したそうです。

主な変更点は以下の通り。

.ready()の改善

$(document).bind("ready", fn);なんて書き方でもdocument readyイベントの利用が可能に。

.bind("mouseenter") / .bind("mouseleave")

.hover()関数を分割したもの。jQuery 1.2.1までは

$("li").hover(function(){
  $(this).addClass("hover");
}, function(){
  $(this).removeClass("hover");
});

と書いていたものは、以下な書き方もできるように。

$("li").bind("mouseenter", function(){
  $(this).addClass("hover");
}).bind("mouseleave", function(){
  $(this).removeClass("hover");
});
.bind("mousewheel")

マウスホイールを扱う関数。

$("div").bind("mousewheel", function(event, delta){
  if ( delta < 0 )
    $(this).append("up");
  else
    $(this).append("down");
});

なんて感じで利用可能。

複雑な:not()指定

CSS 3の仕様には存在しないけど、:not()セレクタに複雑な指定が可能に。
例えば

$(".hover:not(li.active)")

とか

$("li:not(.active,.hover,:contains(test))")

とか。

Accept Headersの変更

jQueryAjax操作で細かなAccept Headerの指定が可能に。

xml application/xml, text/xml
html text/html
script text/javascript, application/javascript
json application/json, text/javascript
text text/plain
Everything else: */*

早速切り替えてみたけど今のところ順調っす。