Created
September 20, 2009 22:34
-
-
Save louisremi/189976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: event.js | |
| =================================================================== | |
| --- event.js (revision 6582) | |
| +++ event.js (working copy) | |
| @@ -7,7 +7,7 @@ | |
| // Bind an event to an element | |
| // Original by Dean Edwards | |
| - add: function( elem, types, handler, data ) { | |
| + add: function( elem, types, handler, data, noSpecial ) { | |
| if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | |
| return; | |
| } | |
| @@ -63,7 +63,7 @@ | |
| var handlers = events[ type ], | |
| special = this.special[ type ] || {}; | |
| - if ( special.add ) { | |
| + if ( special.add && !noSpecial ) { | |
| var modifiedHandler = special.add.call( elem, handler, data, namespaces ); | |
| if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { | |
| modifiedHandler.guid = modifiedHandler.guid || handler.guid; | |
| @@ -78,7 +78,7 @@ | |
| // Check for a special event handler | |
| // Only use addEventListener/attachEvent if the special | |
| // events handler returns false | |
| - if ( !special.setup || special.setup.call( elem, data, namespaces ) === false ) { | |
| + if ( noSpecial || !special.setup || special.setup.call( elem, data, namespaces ) === false ) { | |
| // Bind the global event handler to the element | |
| if ( elem.addEventListener ) { | |
| elem.addEventListener( type, handle, false ); | |
| @@ -534,40 +534,28 @@ | |
| }; | |
| }); | |
| -(function() { | |
| - | |
| +// Make the following events bubble in IE | |
| +jQuery.each(["submit", "change", "select"], function(i, fix) { | |
| var event = jQuery.event, | |
| special = event.special, | |
| - handle = event.handle; | |
| - | |
| - special.submit = { | |
| - setup: function(data, namespaces) { | |
| - if(data.selector) { | |
| - event.add(this, 'click.specialSubmit', function(e, eventData) { | |
| - if(jQuery(e.target).filter(":submit, :image").closest(data.selector).length) { | |
| - e.type = "submit"; | |
| - return handle.call( this, e, eventData ); | |
| - } | |
| - }); | |
| - | |
| - event.add(this, 'keypress.specialSubmit', function( e, eventData ) { | |
| - if(jQuery(e.target).filter(":text, :password").closest(data.selector).length) { | |
| - e.type = "submit"; | |
| - return handle.call( this, e, eventData ); | |
| - } | |
| - }); | |
| - } else { | |
| - return false; | |
| - } | |
| - }, | |
| + handle = event.handle; | |
| - remove: function(namespaces) { | |
| - event.remove(this, 'click.specialSubmit'); | |
| - event.remove(this, 'keypress.specialSubmit'); | |
| + special[fix] = { | |
| + setup: function() { | |
| + jQuery.event.add(this, "focusin.bubbleIE", function( e ) { | |
| + jQuery.event.add(e.data == "submit"? jQuery(e.target).closest("form")[0] : e.target, e.data, function( evt ) { | |
| + console.log(evt.type); | |
| + }, undefined, true); | |
| + }, fix); | |
| + jQuery.event.add(this, "focusout.bubbleIE", function( e ) { | |
| + jQuery.event.remove(e.data == "submit"? jQuery(e.target).closest("form")[0] : e.target, e.data); | |
| + }, fix); | |
| + }, | |
| + teardown: function() { | |
| + //jQuery.event.remove(this, ".bubbleIE"); | |
| } | |
| }; | |
| - | |
| -})(); | |
| +}); | |
| // Create "bubbling" focus and blur events | |
| jQuery.each({ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment