Browserify

Update tests
Would recommend not changing document constructor this much, probably better to just have client-side document that inherits from this document. I think this is also the cause of the massive number of Travis test failures