Updated formatting for the change/submit special event logic. Also switched the function declarations to statements. Thanks to Garrett for the recommendation.
This commit is contained in:
parent
fec02aa5cb
commit
5267824aa3
1 changed files with 85 additions and 84 deletions
23
src/event.js
23
src/event.js
|
@ -652,7 +652,7 @@ jQuery.each({
|
||||||
// submit delegation
|
// submit delegation
|
||||||
if ( !jQuery.support.submitBubbles ) {
|
if ( !jQuery.support.submitBubbles ) {
|
||||||
|
|
||||||
jQuery.event.special.submit = {
|
jQuery.event.special.submit = {
|
||||||
setup: function( data, namespaces ) {
|
setup: function( data, namespaces ) {
|
||||||
if ( this.nodeName.toLowerCase() !== "form" ) {
|
if ( this.nodeName.toLowerCase() !== "form" ) {
|
||||||
jQuery.event.add(this, "click.specialSubmit", function( e ) {
|
jQuery.event.add(this, "click.specialSubmit", function( e ) {
|
||||||
|
@ -680,16 +680,18 @@ jQuery.event.special.submit = {
|
||||||
jQuery.event.remove( this, "click.specialSubmit" );
|
jQuery.event.remove( this, "click.specialSubmit" );
|
||||||
jQuery.event.remove( this, "keypress.specialSubmit" );
|
jQuery.event.remove( this, "keypress.specialSubmit" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// change delegation, happens here so we have bind.
|
// change delegation, happens here so we have bind.
|
||||||
if ( !jQuery.support.changeBubbles ) {
|
if ( !jQuery.support.changeBubbles ) {
|
||||||
|
|
||||||
var formElems = /textarea|input|select/i;
|
var formElems = /textarea|input|select/i,
|
||||||
|
|
||||||
function getVal( elem ) {
|
changeFilters,
|
||||||
|
|
||||||
|
getVal = function( elem ) {
|
||||||
var type = elem.type, val = elem.value;
|
var type = elem.type, val = elem.value;
|
||||||
|
|
||||||
if ( type === "radio" || type === "checkbox" ) {
|
if ( type === "radio" || type === "checkbox" ) {
|
||||||
|
@ -707,9 +709,9 @@ function getVal( elem ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
},
|
||||||
|
|
||||||
function testChange( e ) {
|
testChange = function testChange( e ) {
|
||||||
var elem = e.target, data, val;
|
var elem = e.target, data, val;
|
||||||
|
|
||||||
if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
|
if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
|
||||||
|
@ -732,9 +734,9 @@ function testChange( e ) {
|
||||||
e.type = "change";
|
e.type = "change";
|
||||||
return jQuery.event.trigger( e, arguments[1], elem );
|
return jQuery.event.trigger( e, arguments[1], elem );
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
jQuery.event.special.change = {
|
jQuery.event.special.change = {
|
||||||
filters: {
|
filters: {
|
||||||
focusout: testChange,
|
focusout: testChange,
|
||||||
|
|
||||||
|
@ -782,10 +784,9 @@ jQuery.event.special.change = {
|
||||||
|
|
||||||
return formElems.test( this.nodeName );
|
return formElems.test( this.nodeName );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var changeFilters = jQuery.event.special.change.filters;
|
|
||||||
|
|
||||||
|
changeFilters = jQuery.event.special.change.filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
function trigger( type, elem, args ) {
|
function trigger( type, elem, args ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue