Matt-Esch/virtual-dom — pull request #148 by mmckegg (2014-12-20 23:15:43+00:00)
Title: fix replace stateful widget with vnode

The following test fails:

```js
test("Can replace stateful widget with vnode", function (assert) {
var statefulWidget = {
init: function () {
return render(h("div.widget"))
},
update: function () {},
destroy: function () {},
type: "Widget"
}

var leftNode = h("div", statefulWidget)
var rightNode = h("div", h("div.vnode"))

var rootNode = render(leftNode)

assert.equal(rootNode.childNodes.length, 1)
assert.equal(rootNode.childNodes[0].className, 'widget')

var patches = diff(leftNode, rightNode)
var newRoot = patch(rootNode, patches)

assert.equal(newRoot, rootNode)

assert.equal(newRoot.childNodes.length, 1)
assert.equal(newRoot.childNodes[0].className, 'vnode')

assert.end()
})
```

I've managed to fix by adding a new kind of patch: `VPatch.DESTROY`

All tests pass, hopefully good to go. As long as my approach seems ok :)