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:
jeresig 2010-02-08 23:28:15 -05:00
parent fec02aa5cb
commit 5267824aa3

View file

@ -687,9 +687,11 @@ jQuery.event.special.submit = {
// 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,7 +734,7 @@ 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: {
@ -784,8 +786,7 @@ jQuery.event.special.change = {
} }
}; };
var changeFilters = jQuery.event.special.change.filters; changeFilters = jQuery.event.special.change.filters;
} }
function trigger( type, elem, args ) { function trigger( type, elem, args ) {