Knockout-Contrib / Knockout-Contrib/Knockout-Validation
Opt-out option for makeBindingHandlerValidatable
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 366
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Src/bindingHandlers.js, especially lines 46-51 and the validationCore binding handler referenced in the issue. Read how makeBindingHandlerValidatable is invoked and how ko-es5 property getters/setters affect the observable argument. Done should include a clear opt-out behavior and confirmation of the requested validationCore efficiency change, with relevant existing tests updated or added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100