QEvent library 事件库

QEvent??- a powerful tiny extensible standalone event library for elements and objects
?? -QEvent 为个元素及对象提供一个强大的可扩展的事件库

????* lightweight footprint
????* no namespace pollution – everything is wrapped in obj.$QEvent
????* normalizes the DOM event model
????* work also with Javascript objects
????* fixes common IE bugs including: all common used event properties, IE 2px bug http://ajaxian.com/archives/javascript-tip-cross-browser-cursor-positioning, fix many IE leaks, event handlers are FIFO executed
????* prevents repeated registration of same type and listener
????* ‘this’ in listeners references to object or element itself
????* fixes window ‘beforeunload’ issue (doesn’t work in Opera)
????* fixes window ‘unload’ (must be removed by itself)
????* fixes focus and blur events
????* DOM events are more extendable: event keys, event objects ( event.myCustomFn() ), custom events
????* firing events works for elements
????* toggled and flashed events (removed after first fire)
????* tested on (IE6-7, Firefox2/3, Safari, Opera, Chrome)

Custom Events
These custom events are included, view source to see how to create them.

????* keyenter
????* mouseOverOut
????* mouseenter, mouseleave
????* mouseEnterLeave
????* mousewheel
????* domready
????* beforeunload – doesnt work in Opera
????* clickout – also example to see how to attach custom DOM event

Why another library?

Good question. Several reasons.

????* Occasionally, I need a lightweight library that will work with other frameworks. Frameworks such as jQuery which don’t extend the native prototype and therefor have no compatibility issues are not modular enough to meet my needs.
????* No event implementation is perfect. So I took my own approach to the issue and created my dream package.
????* This implementation could serve as a model for others.

License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel@steigerwald.cz


????* Some ideas and snippets have been taken from Mootools (see source for details).
????* There is also one potential leak for IE. If load event is not fired, also unload will not be fired too. This may be fixed in the future.


赞(0) 打赏
未经允许不得转载:WEB前端开发 » QEvent library 事件库

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准