Merge pull request #199 from arv/document-register-callbacks

Implement document.register lifecycle callbacks
Add support for document.documentElement.appendChild etc