You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the format validation attribute in IE 11 approvejs throws the error that toString is not an object. Below you have the affected function:
/**
* Returns an object containing the arguments for a test's expected parameters.
*/
_getArgs: function(params) {
var pars = {};
// Does the test for this rule expect any paramaters?
this._eachExpected(params, function(expects, expectsLength) {
// Check if the rule object has the required parameter.
if (params.constraint.hasOwnProperty(expects)) {
// Add the expected parameter value to the pars object.
pars[expects] = params.constraint[expects];
} else if (expectsLength <= 1 && (/^[A-Za-z0-9]+$/i.test(params.constraint) || toString.call(params.constraint) === '[object RegExp]')) {
// Set the parameter to the rule's value.
pars[expects] = params.constraint;
} else {
throw 'approve.value(): ' + params.rule + ' expects the ' + expects + ' parameter.';
}
});
// Does the rule have config
if(params.constraint.hasOwnProperty('config')) {
// Add the config to the pars object.
pars.config = params.constraint.config;
}
// Return the parameters object
return pars;
}
The toString call must be corrected to Object.prototype.toString.call(params.constraint) because IE is not that smart to look for toString in Object's prototype.
The text was updated successfully, but these errors were encountered:
Hi,
When using the format validation attribute in IE 11 approvejs throws the error that toString is not an object. Below you have the affected function:
/**
* Returns an object containing the arguments for a test's expected parameters.
*/
_getArgs: function(params) {
var pars = {};
// Does the test for this rule expect any paramaters?
this._eachExpected(params, function(expects, expectsLength) {
// Check if the rule object has the required parameter.
if (params.constraint.hasOwnProperty(expects)) {
// Add the expected parameter value to the pars object.
pars[expects] = params.constraint[expects];
} else if (expectsLength <= 1 && (/^[A-Za-z0-9]+$/i.test(params.constraint) || toString.call(params.constraint) === '[object RegExp]')) {
// Set the parameter to the rule's value.
pars[expects] = params.constraint;
} else {
throw 'approve.value(): ' + params.rule + ' expects the ' + expects + ' parameter.';
}
});
// Does the rule have config
if(params.constraint.hasOwnProperty('config')) {
// Add the config to the pars object.
pars.config = params.constraint.config;
}
// Return the parameters object
return pars;
}
The toString call must be corrected to Object.prototype.toString.call(params.constraint) because IE is not that smart to look for toString in Object's prototype.
The text was updated successfully, but these errors were encountered: