Issue #879580 by arithmetric: Fixed States fail when using integer values for select/radio dependencies.

8.0.x
Nathaniel 2011-09-28 12:31:27 +09:00
parent ee406da55d
commit a8a71c6d8d
1 changed files with 7 additions and 0 deletions

View File

@ -63,6 +63,13 @@ states.Dependent.comparisons = {
'Function': function (reference, value) {
// The "reference" variable is a comparison function.
return reference(value);
},
'Number': function (reference, value) {
// If "reference" is a number and "value" is a string, then cast reference
// as a string before applying the strict comparison in compare(). Otherwise
// numeric keys in the form's #states array fail to match string values
// returned from jQuery's val().
return (value.constructor.name === 'String') ? compare(String(reference), value) : compare(reference, value);
}
};