Hello again
I've now implemented a fix for this problem. Can you grab the latest
build from
https://github.com/SteveSanderson/knockout/tree/master/build/output/
and check that the problem is gone for you?
To fix this problem I was forced to change the API for registering
bindings. If you've written any custom bindings of your own, you'll
need to update your method signatures slightly. Basically, if you
previously wrote this:
ko.bindingHandlers.myCustomBinding = {
init: function(element, value, allBindings, viewModel) {
// Now do something with value/allBindings
},
update: function(element, value, allBindings, viewModel) {
// Now do something with value/allBindings
}
};
... then from version 1.1.1, you need to change it to this:
ko.bindingHandlers.myCustomBinding = {
init: function(element, valueAccessor, allBindingsAccessor,
viewModel) {
var value = valueAccessor(), allBindings =
allBindingsAccessor();
// Now do something with value/allBindings
},
update: function(element, valueAccessor, allBindingsAccessor,
viewModel) {
var value = valueAccessor(), allBindings =
allBindingsAccessor();
// Now do something with value/allBindings
}
};
If you haven't written any custom bindings, you don't need to change
anything, and everything should just work.
I'll write a further post here later to emphasise this custom binding
API change and explain why it was necessary, and will also post a
proper documentation page to
knockoutjs.com about creating custom
bindings. However I can't publish the new documentation until KO
version 1.1.1 is actually released otherwise it will confuse people.
So, it would be great if you could give me your feedback about this
fix ASAP so I can finalise the 1.1.1 release.
Thanks very much!
Steve
On Nov 3, 8:33 am, Steven Sanderson <
ste...@stevensanderson.com>
wrote:
> Hi Josh and Alisson
>
> Thanks for reporting this. Particularly, thanks for the clear repro test
> case.
>
> I've investigated and can confirm this is an issue with the current version
> of Knockout (internally, the "change" handler it registers on the textbox
> only gets registered on initialisation, and so it retains a reference to the
> original observable). I could give you some awkward steps to work around
> this, but to be honest it will be better just to fix it in KO itself. I've
> raised the issue athttps://
github.com/SteveSanderson/knockout/issues/issue/13and will aim to
> fix it this week.
>
> Regards
> Steve
>
> 2010/11/3 Ω Alisson <
thelinuxl...@gmail.com>
>
>
>
>
>
>
>
> > That's exactly my problem too!
>