summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel2011-09-28 03:31:27 (GMT)
committerNathaniel2011-09-28 03:31:27 (GMT)
commita8a71c6d8dfff00a2182355fc98144c0eef5ba1f (patch)
treebfbb85ad55189ffac4b167cb34d9d017f6f04ae7
parentee406da55d6beb7f85d302ebf80fab4933a64af6 (diff)
Issue #879580 by arithmetric: Fixed States fail when using integer values for select/radio dependencies.
-rw-r--r--misc/states.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/misc/states.js b/misc/states.js
index b01bc2b..0b2616b 100644
--- a/misc/states.js
+++ b/misc/states.js
@@ -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);
}
};