<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery</title>
<script src="jquery.js"></script>
</head>
<body>
<div id="aaron">jQuery</div>
<script type="text/javascript">
(function(window, factory){
factory(window);
}(typeof window !== undefined ? window : this, function(window, noGlobal){
var $jQuery = function(selector, context){
return new $jQuery.fn.init( selector, context );
}
$jQuery.fn = $jQuery.prototype = {
init: function(){
this.name = "aa";
return this;
},
constructor: $jQuery
}
if(typeof noGlobal === "undefined"){
window.$jQuery = $jQuery;
}
return $jQuery;
}))
var a = $jQuery();
show(a.name);
function show(data) {
jQuery("body").append(‘<li>‘ + data + ‘</li>‘)
}
</script>
</body>
</html>
原文:http://www.cnblogs.com/darr/p/5104675.html