2012-07-18 59 views
0

我知道jQuery.fn只是jQuery.prototype的別名,但「fn」代表什麼?它有全名嗎?jQuery中的fn代表什麼?

例如,「正式名稱」? 「正式命名空間」?我不知道。

+1

是否「fnctn」幫助? – deceze 2012-07-18 13:02:09

+3

可能是函數。 – jrummell 2012-07-18 13:02:12

+0

它是功能的簡寫。 – Undefined 2012-07-18 13:02:20

回答

5

fnf unctio n

這也是地方的功能,預計正式的參數的名稱:

// Bind a function to a context, optionally partially applying any 
// arguments. 
proxy: function(fn, context) { 
+0

他們命名爲'fn' _whoopee_,但您可以輕鬆地重命名它。它不**必須**被稱爲'fn' – Neal 2012-07-18 13:12:56

+0

@Neal?該操作詢問「fn」代表什麼,它代表「功能」一詞 – Esailija 2012-07-18 13:13:51

+0

也爲什麼不能像** f ** u ** n ** ction那樣是'fn'? :-P – Neal 2012-07-18 13:14:04

2

jQuery.fn只是jQuery.prototype的一個別名(當編碼這樣的jQuery.fn.init.prototype = jQuery.fn = $.fn時,這只是節省了我們的時間)。

如果您還記得JavaScript對象中的prototypes函數,那麼它將會非常有意義。

記住,JQuery本身是一個對象。
article可以幫助你更好地理解。

+0

感謝philippe,它可能是一個簡寫爲「功能」,但有沒有這方面的官方文件?或者,它是傳統的嗎? – shaochuancs 2012-07-18 13:13:21

+1

@cshao我已經更新了我的答案... – cybertextron 2012-07-18 13:17:35

+0

謝謝philippe – shaochuancs 2012-07-18 13:24:16

相關問題