[jQuery] [validate] Dependant on string does not work
So i upgraded to the latest version and waisted my day :(
Seems like the dependant requiring does not work (withh 1.3.1).
The error occures for instance when you have a require: '#item:filled'
option.
What happends is in this code:
depend: function(param, element) {
return this.dependTypes[typeof param]
? this.dependTypes[typeof param](param, element)
: true;
},
dependTypes: {
"boolean": function(param, element) {
return param;
},
"string": function(param, element) {
return !!$(param, element.form).length;
},
"function": function(param, element) {
return param(element);
}
},
The depend function gets called with '#item:filled', and the
formelement.
Then the depenTypes['string'] function gets called, with the same
arguments.
now $(param, element.form) returns nothing .. This is because a string
and an element get combined.
It does work with 2 elements or 2 strings.
Now the easy fix is to just leave of the 2nd term, element.form. IMO
you don't really need it anyway