aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorAriel Flesler <aflesler@gmail.com>2009-09-14 22:04:22 +0000
committerAriel Flesler <aflesler@gmail.com>2009-09-14 22:04:22 +0000
commitbca82254137a161094377b2d8189c2d9d5906a0f (patch)
tree7c219ce2dfc1e4b3abb53b50475ed42ca8ad8c5e /src/event.js
parentf3474c00cd6d9e5fd61b6ef1562003e9986ad67d (diff)
downloadjquery-bca82254137a161094377b2d8189c2d9d5906a0f.tar.gz
jquery-bca82254137a161094377b2d8189c2d9d5906a0f.zip
jquery event: fixes #4989. blur and focus events now bubble and can be handled using live().
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/event.js b/src/event.js
index 9d77314b5..380d3d49e 100644
--- a/src/event.js
+++ b/src/event.js
@@ -518,9 +518,10 @@ var withinElement = function( event ) {
}
};
+// Create mouseenter and mouseleave events
jQuery.each({
- mouseover: 'mouseenter',
- mouseout: 'mouseleave'
+ mouseover: "mouseenter",
+ mouseout: "mouseleave"
}, function( orig, fix ) {
jQuery.event.special[ fix ] = {
setup: function(){
@@ -532,6 +533,36 @@ jQuery.each({
};
});
+// Create "bubbling" focus and blur events
+jQuery.each({
+ focus: "focusin",
+ blur: "focusout"
+}, function( orig, fix ){
+ var event = jQuery.event,
+ special = event.special,
+ handle = event.handle;
+
+ function ieHandler() {
+ arguments[0].type = orig;
+ return handle.apply(this, arguments);
+ }
+
+ special[orig] = {
+ setup:function() {
+ if ( this.addEventListener )
+ this.addEventListener( orig, handle, true );
+ else
+ jQuery.event.add( this, fix, ieHandler );
+ },
+ teardown:function() {
+ if ( this.removeEventListener )
+ this.removeEventListener( orig, handle, true );
+ else
+ jQuery.event.remove( this, fix, ieHandler );
+ }
+ };
+});
+
jQuery.fn.extend({
bind: function( type, data, fn, thisObject ) {
if ( jQuery.isFunction( data ) ) {