'use strict';

var parseHtml = require('../lib/parse-html');
var render = require('../lib/render');
var patch = require('incremental-dom').patch;
var Immutable = require('immutable');

var elm = document.body.appendChild(document.createElement('div'));
elm.contentEditable = true;
elm.innerHTML = '<div>WTF?</div>';

patch(elm, function () {
  render(Immutable.fromJS(parseHtml(elm)));
});

elm.onpaste = function () {
  process.nextTick(function () {
    patch(elm, function () {
      render(Immutable.fromJS(parseHtml(elm)));
    });
  });
};

@@ -182,19 +182,23 @@
 );%0A%0Avar 
-elm
+wrapper
  = docum
@@ -250,16 +250,109 @@
 div'));%0A
+wrapper.className = 'wrapper';%0Avar elm = wrapper.appendChild(document.createElement('div'));%0A
 elm.cont
@@ -392,23 +392,16 @@
  = '
-%3Cdiv%3EWTF?%3C/div%3E
+beepboop
 ';%0A%0A
@@ -477,20 +477,22 @@
 %7D);%0A
-%0A
 elm.on
-paste
+keypress
  = f
@@ -547,92 +547,96 @@
   pa
-tch(elm, function () %7B%0A      render(Immutable.fromJS(parseHtml(elm)));%0A    %7D);%0A  %7D);%0A%7D
+rseHtml(elm);%0A  %7D);%0A%7D;%0A%0Awindow.parse = function () %7B%0A  parseHtml(elm);%0A%7D;%0Awindow.elm = elm
 ;%0A

Update example/client.js