Closed
Description
I have a strange behavior for canCreate()
function.
For example, when plugin was initialized - create
option is set to false
But if later in code change it to true
- I get self.canCreate() is not a function
error.
I think this error holds because canCreate
function is declared only if create
setted to true
when plugin is initializing.
if (self.settings.create) {
self.canCreate = function(input) {
var filter = self.settings.createFilter;
return input.length
&& (typeof filter !== 'function' || filter.apply(self, [input]))
&& (typeof filter !== 'string' || new RegExp(filter).test(input))
&& (!(filter instanceof RegExp) || filter.test(input));
};
}
I think, the canCreate()
function must be declared always. What do you think about this?
Metadata
Metadata
Assignees
Labels
No labels