JQuery源码 3 / 21-94

var
    
    rootjQuery,
    //定义一个顶级变量,实际上就是我们JQuery的$(document)
    readyList,
    
    // Support: IE9
    // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
    core_strundefined = typeof undefined,

    // Use the correct document accordingly with window argument (sandbox)
    location = window.location,
    document = window.document,
    docElem = document.documentElement,

    //以下为防止冲突的写法,如果在外层我们使用了其他框架,并且该框架中有$/JQuery字符,那么再使用JQuery时将该字符定义到_$/_JQuery上
    _jQuery = window.jQuery,
    _$ = window.$,

    // 设定一个变量,值为空数组
    class2type = {},

    //设定一个数组,在JQ中会将数组的方法都赋值到变量
    core_deletedIds = [],
    //JQ版本号
    core_version = "2.0.3",

    //数组、对象方法挂载到变量
    core_concat = core_deletedIds.concat,
    core_push = core_deletedIds.push,
    core_slice = core_deletedIds.slice,
    core_indexOf = core_deletedIds.indexOf,
    core_toString = class2type.toString,
    core_hasOwn = class2type.hasOwnProperty,
    core_trim = core_version.trim,

    //设置JQ方法,返回值为JQuery的原型的init方法,这样做法的好处在第一章说过
    jQuery = function( selector, context ) {
        return new jQuery.fn.init( selector, context, rootjQuery );
    },

    // Used for matching numbers
    core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,

    // Used for splitting on whitespace
    core_rnotwhite = /\S+/g,

    // A simple way to check for HTML strings
    // Prioritize #id over  to avoid XSS via location.hash (#9521)
    // Strict HTML recognition (#11290: must start with <)
    rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,

    // Match a standalone tag
    rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,

    // Matches dashed string for camelizing
    rmsPrefix = /^-ms-/,
    rdashAlpha = /-([\da-z])/gi,

    // Used by jQuery.camelCase as callback to replace()
    fcamelCase = function( all, letter ) {
        return letter.toUpperCase();
    },

    // The ready event handler and self cleanup method
    completed = function() {
        document.removeEventListener( "DOMContentLoaded", completed, false );
        window.removeEventListener( "load", completed, false );
        jQuery.ready();
    };

你可能感兴趣的:(JQuery源码 3 / 21-94)