摘要:
今天编写了一个jQuery插件,虽然效果嘛是达到目的了,但是里边有一个问题暂时无法理解,先记下来再研究:(function($){ var hello = 'hello'; $.myPlugIn = { sayHello:function(){ alert(hello+' world!')}}})(jQuery);使用$.myPlugin.sayHello()可以看到正确的'hello world!'。但问题是hello这个变量生存在哪里呢?也就是这段代码组成的闭包不可能是嵌入到$命名空间中,也不会是在$.myPlugin中(是其父闭包)。那么她 阅读全文
posted @ 2012-09-13 09:30
雨吁的嘘
阅读(126)
评论(0)
推荐(0)

浙公网安备 33010602011771号