n jQuery, the fn property is just an alias to the prototype property.

The jQuery identifier (or $) is just a constructor function, and all instances created with it, inherit from the constructor's prototype.

A simple constructor function:

function Test() {
this.a = 'a';
}
Test.prototype.b = 'b'; var test = new Test();
test.a; // "a", own property
test.b; // "b", inherited property

A simple structure that resembles the architecture of jQuery:

(function() {
var foo = function(arg) { // core constructor
// ensure to use the `new` operator
if (!(this instanceof foo))
return new foo(arg);
// store an argument for this example
this.myArg = arg;
//..
}; // create `fn` alias to `prototype` property
foo.fn = foo.prototype = {
init: function () {/*...*/}
//...
}; // expose the library
window.foo = foo;
})(); // Extension: foo.fn.myPlugin = function () {
alert(this.myArg);
return this; // return `this` for chainability
}; foo("bar").myPlugin(); // alerts "bar"

What does jQuery.fn mean?的更多相关文章

  1. jquery.fn.extend与jquery.extend--(初体验二)

    1.jquery.extend(object); 为扩展jQuery类本身.为类添加新的方法. jquery.fn.extend(object);给jQuery对象添加方法. $.extend({ a ...

  2. jQuery为开发插件提拱了两个方法:jQuery.fn.extend(); jQuery.extend();

    jQuery为开发插件提拱了两个方法,分别是: jQuery.fn.extend(); jQuery.extend(); jQuery.fn jQuery.fn = jQuery.prototype ...

  3. 记jQuery.fn.show的一次踩坑和问题排查

    最近很少已经很少用jQuery,因为主攻移动端,常用Zepto,其实很多细节和jQuery并不一样.最近又无意中接触到了PC的需求和IE6, 使用了jQuery,刚好踩坑了,特意记录一下. 本文内容如 ...

  4. jQuery.extend和jQuery.fn.extend的区别【转】

    解释的很有意思,清晰明了又有趣,转来分享下,哈哈哈 jQuery.extend和jQuery.fn.extend的区别,其实从这两个办法本身也就可以看出来.很多地方说的也不详细.这里详细说说之间的区别 ...

  5. ES6的Iterator,jquery Fn

    ES6的Iterator对象详解 Iterator实现原理 创建一个指针对象,指向当前数据结构的起始位置.也就是说,遍历器对象本质上,就是一个指针对象. 第一次调用指针对象的next方法,可以将指针指 ...

  6. jQuery原生框架中的jQuery.fn.extend和jQuery.extend

    extend 方法在 jQuery 中是一个很重要的方法,jQuey 内部用它来扩展静态方法或实例方法,而且我们开发 jQuery 插件开发的时候也会用到它.但是在内部,是存在 jQuery.fn.e ...

  7. jQuery.fn.extend() 与 jQuery.extend()

    jQuery.fn如何扩展. jQuery插件 $.fn(object)与$.extend(object) jQuery提供了两个方法帮助开发插件 $.extend(object);扩展jQuery类 ...

  8. jQuery.fn.extend(object) object中this的指向

    看到下面的代码后,一下子懵逼了.这个this指向哪儿去了. jQuery.fn.extend({ check: function() { return this.each(function() { t ...

  9. jQuery.extend()方法和jQuery.fn.extend()方法源码分析

    这两个方法用的是相同的代码,一个用于给jQuery对象或者普通对象合并属性和方法一个是针对jQuery对象的实例,对于基本用法举几个例子: html代码如下: <!doctype html> ...

  10. 区别和详解:jQuery extend()和jQuery.fn.extend()

    1.认识jQuery extend()和jQuery.fn.extend() jQuery的API手册中,extend方法挂载在jQuery和jQuery.fn两个不同对象上方法,但在jQuery内部 ...

随机推荐

  1. 【简●解】POJ 1845 【Sumdiv】

    POJ 1845 [Sumdiv] [题目大意] 给定\(A\)和\(B\),求\(A^B\)的所有约数之和,对\(9901\)取模. (对于全部数据,\(0<= A <= B <= ...

  2. [JOYOI] 1051 选课

    题目限制 时间限制 内存限制 评测方式 题目来源 1000ms 131072KiB 标准比较器 Local 题目描述 学校实行学分制.每门的必修课都有固定的学分,同时还必须获得相应的选修课程学分.学校 ...

  3. 关于使用mongodb中遇到的时间戳雷同的问题

    文不对题,实际上不是时间戳,而是我们使用js取当前毫秒数,将他看为时间戳,每次updata的时候,获取当前毫秒数,把它当做create_time的默认值,自动添加到我们的数据库中,数据模型如下 开始的 ...

  4. 将json格式转为url参数格式的方法(xjl456852整理修改)

    测试页面: <html> <head> <script type="text/javascript" src="jquery-1.11.3. ...

  5. Mybatis 处理日期格式自动转换

    java.lang.String和java.util.Date之间自动转换 @DateTimeFormat(pattern="yyyy-MM-dd")//页面写入数据库时格式化 @ ...

  6. 用友NC客户端地址

    http://uclient.yonyou.com/liyan5(李艳) 08-23 14:29:41在这里输入http://10.0.0.67:80

  7. 62. mybatis 使用PageHelper不生效【从零开始学Spring Boot】

    [从零开始学习Spirng Boot-常见异常汇总] 在Spirng Boot中集成了PageHelper,然后也在需要使用分页的地方加入了如下代码: PageHelper.startPage(1,1 ...

  8. fd最大值和限制

    fd的数量决定了fd的最大值 在Linux下,系统全部能够打开的fd总数为: /proc/sys/fs/file-max,取决于内存 The file-max file /proc/sys/fs/fi ...

  9. 【ZJOI2017 Round1练习&BZOJ5350】D5T1 masodik(DP,斜率优化)

    题意:你要从(0,0)点走到(n,m), 每次只能往 x 轴或者 y 轴正方向移动一个单位距离.从(i,j)移动到(i,j+1)的代价为 ri,从(i,j)移动到(i+1,j)的代价为 cj. 求最小 ...

  10. Gym 100801 J. Journey to the “The World’s Start” DP+单调队列优化+二分

    http://codeforces.com/gym/100801 题目大意:有从左到右有n个车站,有n-1种车票,第i种车票一次最多可以坐 i 站(1<=i<=n)   每种票有固定的价钱 ...