您当前的位置: 首页 >  jquery

wespten

暂无认证

  • 1浏览

    0关注

    899博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

深入学习jquery源码之jQuery的二次开发

wespten 发布时间:2018-12-22 23:29:28 ,浏览量:1

深入学习jquery源码之jQuery的二次开发

jquery.js的设计与实现

(function (global, factory) {

    if (typeof module === "object" && typeof module.exports === "object") {
        module.exports = global.document ?
            factory(global, true) :
            function (w) {
                if (!w.document) {
                    throw new Error("jQuery requires a window with a document");
                }
                return factory(w);
            };
    } else {
        factory(global);
    }

}(typeof window !== "undefined" ? window : this, function (window, noGlobal) {

    var deletedIds = [];

    var slice = deletedIds.slice;

    var concat = deletedIds.concat;

    var push = deletedIds.push;

    var indexOf = deletedIds.indexOf;

    var class2type = {};

    var toString = class2type.toString;

    var hasOwn = class2type.hasOwnProperty;

    var support = {};

    var
        version = "1.11.3",

        // Define a local copy of jQuery
        jQuery = function (selector, context) {
            // The jQuery object is actually just the init constructor 'enhanced'
            // Need init if jQuery is called (just allow error to be thrown if not included)
            return new jQuery.fn.init(selector, context);
        },

        // Support: Android= 3 && str.charAt(0) === "";
    };
    coreString.prototype.isHtmlText = function () { return coreString.isHtmlText(this); };

    //  用新字符串替换与给定字符串匹配的所有子串;该方法将返回源字符串处理后的一个副本,而不会改变源字符串的值。
    coreString.replaceAll = function (str, substr, replacement, ignoreCase) {
        if (!substr || substr == replacement) { return str; }
        //var regexp = coreUtil.isRegExp(substr) ? substr : new RegExp(String(substr), ignoreCase ? "gm" : "igm");
        //return str.replace(regexp, replacement);
        str = coreString.isNullOrEmpty(str) ? "" : String(str);
        var length = str.length, i = 0;
        while (str.indexOf(substr) > -1 && i++ < length) { str = str.replace(substr, replacement); }
        return str;
    };
    coreString.prototype.replaceAll = function (substr, replacement) { return coreString.replaceAll(this, substr, replacement); };

    //  去除字符串左边的空格;该方法将返回源字符串处理后的一个副本,而不会改变源字符串的值。
    coreString.ltrim = function (str) {
        str = coreString.isNullOrEmpty(str) ? "" : String(str);
        return str.replace(/(^\s*)/g, "");
    };
    coreString.prototype.ltrim = function () { return coreString.ltrim(this); };

    //  去除字符串右边的空格;该方法将返回源字符串处理后的一个副本,而不会改变源字符串的值。
    coreString.rtrim = function () {
        str = coreString.isNullOrEmpty(str) ? "" : String(str);
        return str.replace(/(\s*$)/g, "");
    };
    coreString.prototype.rtrim = function () { return coreString.rtrim(this); };


})(window, jQuery);




使用

                $Core.UI.openDialog("editwind", url + "&"+_self.listOption.idKey+"=" + rows[0][_self.listOption.idKey]+"&type=close",
                    {
                        title: "关闭",
                        width: '50%',
                        height: '90%',
                        onClose: function () {
                            $("#dglist").datagrid("load");
                        }
                    });


        var key = $.util.request[$id];
        var type = $.util.request["type"];

 

 

 

 

 

 

 

 

 

 

关注
打赏
1665965058
查看更多评论
立即登录/注册

微信扫码登录

0.0452s