From 10418410b57d2a31f931cbbb887b12a806a70b70 Mon Sep 17 00:00:00 2001 From: moity Date: Thu, 31 Oct 2013 16:16:03 +1300 Subject: [PATCH] Add bindingContext to bindingHandlers to support Knockout 3.0 --- knockout.command.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/knockout.command.js b/knockout.command.js index 6ee180f..8585061 100644 --- a/knockout.command.js +++ b/knockout.command.js @@ -73,7 +73,7 @@ }; ko.bindingHandlers.command = { - init: function (element, valueAccessor, allBindingsAccessor, viewModel) { + init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var value = valueAccessor(), commands = value.execute ? { click: value } : value, @@ -92,7 +92,8 @@ element, ko.utils.wrapAccessor(commands[command].execute), allBindingsAccessor, - viewModel + viewModel, + bindingContext ); } }, @@ -110,14 +111,15 @@ element, ko.utils.wrapAccessor(events), allBindingsAccessor, - viewModel); + viewModel, + bindingContext); }; initBindingHandlers(); initEventHandlers(); }, - update: function (element, valueAccessor, allBindingsAccessor, viewModel) { + update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var commands = valueAccessor(); var canExecute = commands.canExecute; @@ -134,7 +136,7 @@ return; } - ko.bindingHandlers.enable.update(element, canExecute, allBindingsAccessor, viewModel); + ko.bindingHandlers.enable.update(element, canExecute, allBindingsAccessor, viewModel, bindingContext); } }; -})(ko); \ No newline at end of file +})(ko);