1 ko.bindingHandlers['visible'] = {
2 'update': function (element, valueAccessor) {
3 var value = ko.utils.unwrapObservable(valueAccessor());
4 var isCurrentlyVisible = !(element.style.display == "none");
5 if (value && !isCurrentlyVisible)
6 element.style.display = "";
7 else if ((!value) && isCurrentlyVisible)
8 element.style.display = "none";