jQuery.fn是什么意思?

JavaScript

小哥达蒙卡卡西

2020-03-12

这是什么fn意思?

jQuery.fn.jquery

第983篇《jQuery.fn是什么意思?》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

2个回答
老丝村村Stafan 2020.03.12

在jQuery源代码中,我们jQuery.fn = jQuery.prototype = {...}既然jQuery.prototype是对象,则的值jQuery.fn将仅仅是对jQuery.prototype已经引用的同一对象的引用。

为了确认这一点,您可以检查(jQuery.fn === jQuery.prototype如果true这样做),然后他们引用相同的对象

乐小小猪猪 2020.03.12

jQuery.fn是的简写形式jQuery.prototype源代码

jQuery.fn = jQuery.prototype = {
    // ...
}

这意味着jQuery.fn.jquery是的别名jQuery.prototype.jquery,它返回当前的jQuery版本。再次从源代码

// The current version of jQuery being used
jquery: "@VERSION",

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android