Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows the UI to stay in sync even if the INPUT is toggled by code
outside of the plugin (either by JS or by the browser if the user clicks
a wrapping LABEL for example)
Calling
fakeCheckable.toggleClass('checked');
has the downside of not actually syncing the UI but just switching its state which in most cases is fine. But there are also cases when the source INPUT is toggled directly in some of various ways and then the UI can't catch up no matter how many times the user actions on the plugin's DOM elements.There's only one concern I have about this commit and it relates to my complete ignorance regarding the Knockout library, and being unable to test if ko functionality is affected.
Also in
destroy()
it seems the source INPUT will be deleted from the DOM so there's no real need to detach events bound to it. But am I wrong?Cheers