-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RegisterExtenders invoked before Init, cannot avoid adding rules to ko.extends. #404
Comments
@slaneyrw Indeed, you cannot prevent the rules from being registered during init, but why would you need this? You can change / remove / replace the builtin rules quite easily. Can you provide a use case for this? Thanks. |
To avoid a clash of registered extenders. |
I would recommend choosing unique names for your custom rules. But the problem I currently see is that although we have a |
It's not only custom rules, but you are also competing with all other knockout extenders. for example, I had a number extension that forces all values into an observable to be converted into a number ( as knockout will push in a text value if bound to an input ). The number extender from the validation library overwrote mine forcing me to rename my custom extender. |
@slaneyrw Sorry for the delay on this one. Until some sort of solution is found for this you may choose to code an unregister method like the following: function unregisterExtenders() {
for (var ruleName in ko.validation.rules) {
if (ko.validation.rules.hasOwnProperty(ruleName)) {
if (ko.extenders[ruleName]) {
delete ko.extenders[ruleName];
}
}
}
} This method will leave the other extenders like |
There is an option to set registerExtenders to false when init is invoked to bypass registerExtenders, but the bootstrap has already executed kv.registerExtenders ( ~ line 914 )
You cannot avoid registering all the rules as ko.extensions
The text was updated successfully, but these errors were encountered: