Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to be used with any DOM implementation #124

Open
matthewp opened this issue Feb 11, 2016 · 4 comments
Open

Allow to be used with any DOM implementation #124

matthewp opened this issue Feb 11, 2016 · 4 comments

Comments

@matthewp
Copy link
Contributor

Currently we rely on can/util/vdom/vdom but it would be nice if it could work with jsdom since that is more robust.

@matthewp matthewp added this to the 0.12 milestone Feb 11, 2016
@matthewp matthewp modified the milestones: 0.12, 0.13 Apr 12, 2016
@matthewp
Copy link
Contributor Author

Deferring this for now, it's harder than it sounds. Currently canjs maps can/util/vdom/vdom to load on the server, so we'd want to disable that somehow when using an alternative implementation.

@matthewp matthewp removed this from the 0.13 milestone Apr 13, 2016
@matthewp
Copy link
Contributor Author

This should be possible now with can 3.0. We no longer shim any libraries.

@matthewp
Copy link
Contributor Author

matthewp commented Aug 7, 2017

Just a matter of picking an API now. We need to be able to receive a window object that is distinct for each request. So if the user provides their own DOM implementation a function makes most sense. My first thought is:

const ssr = require("done-ssr");
const { JSDOM } = require("jsdom");

function makeDom() {
  var dom = new JSDOM();
  return dom.window;
}

const render = ssr({}, {
  dom: makeDom
}); 

@matthewp
Copy link
Contributor Author

matthewp commented Aug 8, 2017

cc @justinbmeyer what do you think about the above API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant