-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
"You cannot apply bindings multiple times to the same element" during traversing a DOM tree after applyBindings #1053
Comments
Try to call |
So in fact if I call cleanNode then all subscriptions will be disposed contrary to the desired result. |
But you get this exception just because you call ko.cleanNode(element);
ko.applyBindgings(viewModel, element); |
Unfortunately, the scenario you are talking about is not my case. I don't call applyBindings several times. In my case, it is called exactly once. The problem is that the Knockout recursively traverses DOM tree, and when it encounters a node, which is processed in the same call stack, error is triggered. |
Probably you can fix this by returning |
Oh, I understood the problem. Do you really need to move existing element somewhere else? It's a little bit strange behavior. Looks like some type of hacks. You creates instance of anonymous template engine just because you want to call nodes method. And then you call |
I'll close this as it's by design (and so old that it's unlikely still to be an active concern). Please reopen if anyone disagrees! |
I have сustom binding handler 'overlay', which moves content into another container during the processing (see http://jsfiddle.net/San4es/ESCT4/). After calling ko.applyBindings, I get the exception: "You cannot apply bindings multiple times to the same element". I understand that the problem is related to a modification of the DOM tree during traversing by Knockout.
How can I avoid this issue? Is the problem the expected?
Thanks,
Alexander.
The text was updated successfully, but these errors were encountered: