JQuery框架原理模拟实现
(function(){ /* window['hyl'] = {} function $(){ alert("this is my message"); } window['hyl']['$'] = $; */ var $ = jQuery = window.jQuery = function(){ return new jQuery.fn.init(); } jQuery.fn = jQuery.prototype = { init:function(){ alert("init"); return this; }, size:function(){ alert("size11111"); }, jquery:"1.0.0" } jQuery.fn.init.prototype = jQuery.fn; jQuery().size(); })()
调用部分的代码
alert($().jquery);