jquery proxy
slice = Array.prototype.slice,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var tmp = fn[ context ];
context = fn;
fn = tmp;
} // Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
} // Simulated bind
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) );
}; // Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; return proxy;
},
jquery proxy的更多相关文章
- 个人对JQuery Proxy()函数的理解
转载至:http://www.cnblogs.com/acles/archive/2012/11/20/2779282.html JQuery.proxy(function,context): 使用c ...
- jquery $.proxy使用
在某些情况下,我们调用Javascript函数时候,this指针并不一定是我们所期望的那个.例如: //正常的this使用 $('#myElement').click(function() { // ...
- 【转】个人对JQuery Proxy()函数的理解
原文地址:http://www.cnblogs.com/acles/archive/2012/11/20/2779282.html JQuery.proxy(function,context): 使用 ...
- jQuery.proxy()函数
jQuery.proxy(),接受一个函数,然后返回一个新函数,并且这个新函数始终保持了特定的上下文(context)语境. context 代表上下文 name是上下文的某个属性 jQuery. ...
- jQuery proxy详解
第一次接触jQuery.proxy()时感觉这个方法不实用,不明白它到底是个什么意思.今天来将jQuery官网上的解释进行一下翻译,顺便添加自己的理解和一些示例.proxy也可称为代理. jQuery ...
- jquery.proxy的四种使用场景及疑问
作者:zccst 其实只有两种使用方式,只不过每一种又细分是否传参. 先给一段HTML,后面会用来测试: <p><button id="test">Test ...
- jQuery.proxy() 函数详解
jQuery.proxy()函数用于改变函数的上下文. 你可以将指定函数传入该函数,该函数将返回一个新的函数,其执行代码不变,但函数内部的上下文(this)已经被更改为指定值. 该函数属于全局的jQu ...
- jQuery.proxy()的用法
一:参考范文一 第一次接触jQuery.proxy()时感觉这个方法不实用,不明白它到底是个什么意思.今天来将jQuery官网上的解释进行一下翻译,顺便添加自己的理解和一些示例.proxy也可称为代理 ...
- (转)jquery $.proxy的使用
在某些情况下,我们调用Javascript函数时候,this指针并不一定是我们所期望的那个.例如: 1 //正常的this使用 2 $('#myElement').click(function() { ...
- jquery $.proxy使用 Jquery实现ready()的源码
jquery $.proxy使用 在某些情况下,我们调用Javascript函数时候,this指针并不一定是我们所期望的那个.例如: 1 //正常的this使用 2 $('#myElement') ...
随机推荐
- AJAX开发技术--AJAX简介
Asynchronous JavaScript and XML,异步JavaScript和XML 主要目的用于页面的局部刷新.不用全部刷新,提高性能. 在AJAX中主要是通过XMLHttpReque ...
- CakePHP下使用paginator需要对多个字段排序的做法
原文:http://blog.csdn.net/kunshan_shenbin/article/details/7644603 CakePHP下使用paginator需要对多个字段排序的做法 2 ...
- TCP/IP Protocol Fundamentals Explained with a Diagram
最近准备系统学习网络相关的知识,主要学习tcp/ip, websocket 知识. 原文地址:http://www.thegeekstuff.com/2011/11/tcp-ip-fundamenta ...
- Linux基本命令之用户系统相关命令
1.格式说明 [simon@localhost simon]$ [simon@localhost ~]$ 这两种方式表示相同.simon是指定用户,localhost是计算机名字,如果不设置默认为lo ...
- HDU 1217 Arbitrage(Floyd的应用)
给出一些国家之间的汇率,看看能否从中发现某些肮脏的......朋友交易. 这是Floyd的应用,dp思想,每次都选取最大值,最后看看自己跟自己的.....交易是否大于一.... #include< ...
- 转:web_custom_request 函数
语法:Int web_custom_request (const char *RequestName, <List of Attributes>, [EXTRARES, <List ...
- web.xml的启动顺序
1. context-param 2. Listener 3. Filter 4. servlet <?xml version="1.0" encoding="UT ...
- JAVA基础-抽象类
1. 用abstract关键字来修饰一个类时, 这个类叫做抽象类, 用abstract修饰一个方法时, 该方法叫做抽象方法 2. 含有抽象方法的类必须被声明为抽象类, 3. 抽象类必须被继承, 抽象方 ...
- android4.0 的图库Gallery2代码分析(二)
最近迫于生存压力,不得不给人兼职打工.故在博文中加了个求点击的链接.麻烦有时间的博友们帮我点击一下.没时间的不用勉强啊.不过请放心,我是做技术的,肯定链接没病毒,就是我打工的淘宝店铺.嘻嘻.http: ...
- 对STM32的NVIC_PriorityGroupConfig使用及优先级分组方式理解(转)
源:http://blog.chinaunix.net/uid-22670933-id-3443085.html STM32有43个channel的settable的中断源:AIRC(Applicat ...