diff options
author | jeresig <jeresig@gmail.com> | 2010-02-05 11:02:56 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-02-05 11:02:56 -0500 |
commit | 43b3ed086dd850388c72ea1cabb557125dfe095a (patch) | |
tree | 01bd95fd0ff53c3f879cb68b507d5b641eda5f25 /src | |
parent | 6f7adb95c1f87869e071541c7e5c92a6189db713 (diff) | |
download | jquery-43b3ed086dd850388c72ea1cabb557125dfe095a.tar.gz jquery-43b3ed086dd850388c72ea1cabb557125dfe095a.zip |
Update special events to work with the internal event system changes. Also fixes #5967.
Diffstat (limited to 'src')
-rw-r--r-- | src/event.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/event.js b/src/event.js index f7c69f84e..821ea0e48 100644 --- a/src/event.js +++ b/src/event.js @@ -99,7 +99,7 @@ jQuery.event = { // 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 ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); @@ -502,16 +502,16 @@ jQuery.event = { }, beforeunload: { - setup: function( data, namespaces, fn ) { + setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( this.setInterval ) { - this.onbeforeunload = fn; + this.onbeforeunload = eventHandle; } return false; }, - teardown: function( namespaces, fn ) { - if ( this.onbeforeunload === fn ) { + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } @@ -653,9 +653,9 @@ jQuery.each({ if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { - setup: function( data, namespaces, fn ) { + setup: function( data, namespaces ) { if ( this.nodeName.toLowerCase() !== "form" ) { - jQuery.event.add(this, "click.specialSubmit." + fn.guid, function( e ) { + jQuery.event.add(this, "click.specialSubmit", function( e ) { var elem = e.target, type = elem.type; if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { @@ -663,7 +663,7 @@ jQuery.event.special.submit = { } }); - jQuery.event.add(this, "keypress.specialSubmit." + fn.guid, function( e ) { + jQuery.event.add(this, "keypress.specialSubmit", function( e ) { var elem = e.target, type = elem.type; if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { @@ -676,9 +676,9 @@ jQuery.event.special.submit = { } }, - remove: function( namespaces, fn ) { - jQuery.event.remove( this, "click.specialSubmit" + (fn ? "."+fn.guid : "") ); - jQuery.event.remove( this, "keypress.specialSubmit" + (fn ? "."+fn.guid : "") ); + teardown: function( namespaces ) { + jQuery.event.remove( this, "click.specialSubmit" ); + jQuery.event.remove( this, "keypress.specialSubmit" ); } }; @@ -766,16 +766,18 @@ jQuery.event.special.change = { jQuery.data( elem, "_change_data", getVal(elem) ); } }, - setup: function( data, namespaces, fn ) { + + setup: function( data, namespaces ) { for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] ); + jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); } return formElems.test( this.nodeName ); }, - remove: function( namespaces, fn ) { + + teardown: function( namespaces ) { for ( var type in changeFilters ) { - jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] ); + jQuery.event.remove( this, type + ".specialChange", changeFilters[type] ); } return formElems.test( this.nodeName ); |