Version 2.2+ from knockout will not clear the DOM element when with bound initially to an object (or other plausible value). Alternatively, you can use the withlight binding that I collected some time ago. It will be attached only to the object (and not to the observable).
ko.bindingHandlers['withlight'] = { 'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var bindingValue = valueAccessor(); if (typeof bindingValue != 'object' || bindingValue === null) throw new Error('withlight must be used with an object'); var innerContext = bindingContext['createChildContext'](bindingValue); ko.applyBindingsToDescendants(innerContext, element); return { 'controlsDescendantBindings': true }; } };
source share