事件模型也算是客户端兼容性的一个长期问题,早期 jquery 作者甚至因为这方面获过奖
?一般来说 attachEvent
以及 addEventListener
已经基本够用,特别是 attachEvent 可以给回调传递事件参数
了,不用考虑怪异的 window.event
div.onclick=function(){
alert(window.event==window.event); // => false
setTimeout(function(){
alert(window.event) // => null
},0);
}
可仍然不是完美的.
attachEvent 传入的参数似乎仅仅是 window.event 的指针:
document.getElementById("input1").attachEvent("onclick",function(e){
var e2=e;
alert(e2==e);
setTimeout(function(){
alert(e2==e);
alert(e2.type);
alert(e.type);
},10);
});
并且只在当前事件处理器同步处理内有效,一旦异步读取就会抛出 error
attachEvent :
1. 没有 event.currentTarget
,重用函数就不行了
2.回调中 this 无意义得指向
window .
3.多个回调绑定同一事件,触发顺序竟然是 random
4.标准事件缺失:hashchange
5.需要模拟一些有用的事件:valuechange
6.修正:其实这种方式不会导致循环引用而造成内容泄露,节点并没有属性指向绑定的事件函数。
addEventListener
1.标准控制下缺失了不少有用事件,需要事件模型来进行辅助模拟: focusin
/out , mouseenter
/leave
2. this 死板,只能是当前监听元素
JAEM
so 在巨人( jquery )的肩上,kissy 有了个不一样的事件模型
:
区分普通对象(继承 EventTarget)的自定义事件监听与触发以及 dom 节点的原生事件监听与触发.
1.每个元素每个对象对应一个系统事件回调,系统回调关联当前注册源解决 currentTarget 与 this,normalize 后调用用户事件回调
2.通过绑定时传入 scope 来实现用户事件回调定制 this
3.自身实现用户回调队列,保证用户回调触发顺序(先进先出)
4.通过钩子实现特殊事件,模拟事件的无缝接入。
- 大小: 35.2 KB
分享到:
相关推荐
Just Another
Android-Just-Another-Android-App.zip,一个android基础应用程序,包含大量的酷库/配置,安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux内核之上构建的,具有安全性优势。
MODE_Switch1Processing multi-interrupt request needs to set the priority of these interrupt requests. The IRQ flags of the 7 interrupt ... Just only any the event occurs and the IRQ will be logic "1".
一个国外的全景虚拟漫游软件。支持一下的插件 * krpano (www.krpano.com) * PurePlayer or PurePlayerPro-Plugin (www.immervision.com) ... * PTViewer by Helmut Dersch and/or (Fulvio Senore) ...
BeatKeeper Just another android metronome! Beat Keeper @ Google Play See Also: Master's Touch: Crafting a Metronome with Audio Synthesis
另一个论坛(Just Another Forum)是一个看起来与PHPBB2类似的论坛,但JAF的速度很快。 JAF还具有缓存模板引擎。
Just Another Multipart Parser是Multipart / form-data(RFC 1867)编码解析器的基于Java的实现。
OFDM Signal generation and ... Just run the Model and with different SNRs in the Channel Block observe the performance of the OFDM. Please leave your feedback for the model so that we can improve it.
贵族 Just Another Roguelike(for js13k) 这应该是它的链接: :
(Janat:Just Another Non-Artistic Tool)是一种简单且用户友好的用Java编写的矢量绘图软件。 它的特殊性是将数据存储在SQL数据库中。 这些事实使它能够在网站上运行或将数据存储在远程站点上
event counter, to count digital events just once
2.Just write a jsonModel name 3.Build the project (->Make Project) Then you can use UserInfo to do something~ GIF Demo Picture is big,wait a minute... Usage 1.Add apt in project's build.gradle ...
Just
justtrustme v4版本
JABFR 或 Just Another Batch Files Renamer 是一个简单而小巧的文件重命名程序。 它允许您一次重命名多个文件。
JAVT 或 Just Another Voice Transformer(以前称为 Just Another Video Transcriber)是一种语音识别软件,它还支持文本到语音和简单的媒体转换。 JAVT 允许您使用 ffmpeg 从视频文件转换为音频 wav 文件,然后使用...
该软件包从R内部运行JAGS (Just Another Gibbs Sampler)分析。 它充当rjags包中功能的包装器和备用接口,并添加了一些自定义输出和图形选项。 这也使并行运行的链条既快速又容易。 您可以从安装该软件包,也可以...
JAETL - Just Another ETL 工具是一种用于开发数据仓库的小巧快速的 ETL 工具。 JAETL 允许从 ARFF (Weka)、CSV 和 SQL 中提取数据,使用连接转换数据,替换缺失值,删除重复项,映射过滤,变量选择,以及将数据加载...
just trust me用来解决ssl认证的问题,懂得都懂
JAB 是一个基本的 Web 浏览器,完全用 VB.NET 编写,作为个人项目,希望对其他对类似项目感兴趣的初级程序员有所帮助。