knockout/knockout — pull request #716 by mbest (2013-09-13 01:45:43+00:00)
Title: Template binding does not remove existing content

[This fiddle](http://jsfiddle.net/tyrsius/LBm9V/) demonstrates the issue.

I would expect a template to remove any content that exists in the DOM when Knockout activates. This is not the case. Instead, the contents to be controlled by the binding are added as the first set of children, prepending any existing content.

I'm not sure if this is intentional, but it seems like it should remove it, as the binding should represent the total content after Knockout activates. It would also help set default content to support some level of content for users with javascript disabled (by letting the server set the initial content, and then allow knockout to replace it.)

Here is the code from the fiddle, for ease of access.

```javascript

var ViewModel = function(data) {
var self = this;
self.names = ko.observableArray(data);
self.resetNames = function() {
self.names.removeAll();
var newData = ["John", "Ryan", "Alex"];
ko.utils.arrayPushAll(self.names, newData)
};
};

var init = ["Tim", "Sarah", "Lea"];

ko.applyBindings(new ViewModel(init));​
```

```HTML

Guy 1

Guy 2

Guy 3

Reset

​```