jQuery 1.0.4 - New Wave Javascript(js源文件)

2019-06-03 09:49:42刘景俊

            }
            // Remove event lisenter to avoid memory leak
            if ( jQuery.browser.mozilla || jQuery.browser.opera )
                document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
        }
    }
});

new function(){

    var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
        "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + 
        "submit,keydown,keypress,keyup,error").split(",");

    // Go through all the event names, but make sure that
    // it is enclosed properly
    for ( var i = 0; i < e.length; i++ ) new function(){

        var o = e[i];

        // Handle event binding
        jQuery.fn[o] = function(f){
            return f ? this.bind(o, f) : this.trigger(o);
        };

        // Handle event unbinding
        jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };

        // Finally, handle events that only fire once
        jQuery.fn["one"+o] = function(f){
            // save cloned reference to this
            var element = jQuery(this);
            var handler = function() {
                // unbind itself when executed
                element.unbind(o, handler);
                element = null;