-
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
Opt-out option for makeBindingHandlerValidatable #477
Comments
I see more control over default options, extenders registration is required and is something which will be addressed in the future. |
@jods4 Can you provide a fiddle as a starting point? |
Those are simple changes. When I have a bit of time I'll try to create a PR. |
I was actually referring to a fiddle using |
Using ko-es5 together with knockout-validation is worthy more than a quick fiddle I'm afraid. 1st setting up the validation rules. Could be done by creating the 2nd creating the 3rd setting up the validation bindings. To avoid setting them up manually we created a KO binding pre-processor. It turns There's more to it but I guess you get the key ideas. |
I would love if there was an option to opt-out of the 'hacking' of regular bindings with validation binding handlers. All it takes is put lines 46-51 of bindingHandlers.js inside a
if
.My use case is that I use this validation library with property getters/setters (i.e. ko-es5) and because of this
makeBindingHandlerValidatable
does not work for me anyway (because it does not receive the observable object, only its value).BTW, while I was reading this piece of code I noticed that
ko.bindingHandlers.validationCore
is executed in many bindings but is not the most efficient.Why not wrap all the code inside a
if (ko.validation.utils.isValidatable(observable))
? If it's not true this function is a no-op. But currently it would still read the config for the element, check 3 different config settings and check the above condition 3 times :( As a side-effect it would also reduce code size.The text was updated successfully, but these errors were encountered: