jquery之event与originalEvent的关系、event事件对象用法浅析


在jquery中,最终传入事件处理程序的 event 其实已经被 jQuery 做过标准化处理,

其原有的事件对象则被保存于 event 对象的 originalEvent 属性之中,

每个 event 都是 jQuery.Event 的实例

其原型链中保存有六个方法,

 

 代码如下 复制代码

jQuery.Event.prototype = { 
    preventDefault: function() { 
        // 取消事件默认行为 
    }, 
    stopPropagation: function() { 
        // 取消事件向上冒泡 
    }, 
    stopImmediatePropagation: function() { 
        this.isImmediatePropagationStopped = returnTrue; 
        this.stopPropagation(); 
    }, 
    isDefaultPrevented: returnFalse, 
    isPropagationStopped: returnFalse, 
    isImmediatePropagationStopped: returnFalse 
};


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM