$的定义不应该是 function $(str){...}这样的吗?
jQuery为什么是这种形式.
谁能帮我解释下,下面代码的意思 ? // Map over jQuery in case of overwrite
_jQuery = window.jQuery, // Map over the $ in case of overwrite
_$ = window.$,
// ----------------------- //
jQuery.extend({
noConflict: function( deep ) {
window.$ = _$; if ( deep ) {
window.jQuery = _jQuery;
} return jQuery;
},
...
jQuery为什么是这种形式.
谁能帮我解释下,下面代码的意思 ? // Map over jQuery in case of overwrite
_jQuery = window.jQuery, // Map over the $ in case of overwrite
_$ = window.$,
// ----------------------- //
jQuery.extend({
noConflict: function( deep ) {
window.$ = _$; if ( deep ) {
window.jQuery = _jQuery;
} return jQuery;
},
...
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
};
1.2.6 18行.
var $ = function(id){return document.getElementById(id);}