﻿# jQuery 1.3 正式版出爐了!

就在剛剛幾個小時前，[jQuery](http://jquery.com/) 1.3 最新版[剛剛出爐](http://docs.jquery.com/Release:jQuery_1.3)，而昨天(1/14)也正好就是 jQuery 的三週年生日。在 jQuery 1.3 這版有許多核心的程式碼已經重新寫過，效能大幅提昇數倍之多，詳細的說明各位可以參考 [jQuery 1.3 Release Note](http://docs.jquery.com/Release:jQuery_1.3) 文件，裡面有包含部分效能數據的圖表。

另外，在 jQuery 1.3 也新增了幾個功能特性：

-   jQuery 內建的選取器(Selector)已改用 [Sizzle Selector Engine](http://sizzlejs.com/)
    -   雖然原本 jQuery 1.2.6 的選取器效能就已經不錯了，但新版 Selector Engine 的執行效率竟然還高出舊版約 49% 之多。對於使用者來說，Selector 的使用上跟以前並無差別。
-   新增 Live Events 功能
    -   類似之前的 [bind](http://docs.jquery.com/Events/bind#typedatafn) 方法，但透過新的 [live](http://docs.jquery.com/Events/live#typefn) 方法可以讓綁定(bind)的事件也一併套用在 callback 中新增的 HTML 元素。
    -   詳細的說明與範例可以參考 [.live](http://docs.jquery.com/Events/live) and [.die](http://docs.jquery.com/Events/die) 文件。
-   jQuery Event 全面翻修過
    -   [jQuery.Event](http://docs.jquery.com/Events/jQuery.Event) 重寫過，讓事件系統可以更完整的跨平台支援。
-   HTML Injection Rewrite
    -   動態寫入 HTML 元素的方法（例如 [append](http://docs.jquery.com/Manipulation/append#content), [prepend](http://docs.jquery.com/Manipulation/prepend#content), [before](http://docs.jquery.com/Manipulation/before#content), [after](http://docs.jquery.com/Manipulation/after#content) 等）也重新改寫過，整理執行的效率高達**六倍**之多，這意思是說之後用 jQuery 動態顯示網頁(Dyanmic Rendering)將會比以往更佳順暢。
-   Offset Rewrite
    -   定位(Offset)相關的程式也重新改寫過，除了更加跨瀏覽器支援外，執行速度也比以往快**三倍**左右。
-   No More Browser Sniffing
    -   偵測瀏覽器的種類與版本不在使用以往抓 User-Agent 的方式了，現在改用 feature detection 技術，透過偵測瀏覽器是否支援某種物件、Bug或特性來判斷瀏覽器的種類與版本。
    -   所有相關的程式都被整合進 [jQuery.support](http://docs.jquery.com/Utilities/jQuery.support) 物件中。
-   最常用的 .hide() 與 .show() 方法也被改寫過
    -   執行速度大約快 2.5 倍左右，不過這速度應該只有電腦慢的人有感覺吧。

另外還有其他像是「升級的注意事項」、「需改寫的語法」與「測試數據」…等等，都在 [jQuery 1.3 Release Note](http://docs.jquery.com/Release:jQuery_1.3) 中有交代，建議各位可以去看看。

各位也可以考慮參考我 "[網站部署可考慮使用 Google AJAX Libraries API 載入 JS](/post/2008/10/31/Consider-using-Google-AJAX-Libraries-API-when-deploying-website)" 這篇文章所介紹的方法來載入 jQuery 1.3，語法如下：

```
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" language="javascript">
google.load("jquery", "1.3");
</script>
```
