-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
Hi, thanks for creating morphdom.
It looks like testing morphdom with jsdom is quite tricky, e.g. https://runkit.com/autosponge/morphdom-jsdom-example
Having to set up a global document before invoking morphdom is tricky when there are lots of tests which might use different doms.
Might I propose adding an option, e.g. morphdom(..., ..., document: dom.window.document) or something similar that allows us to inject this into the individual calls? Alternatively, maybe we can extract it from the first argument?
I see some additional discussion here: #98
Another idea is to introduce a class which contains the state.
e.g.
morphdom = new Morphdom(document);
morphdom.morph(...)
In my own code, I have something like this:
constructor(window) {
this.window = window;
this.document = window.document;
This makes testing using jsdom extremely easy.
Metadata
Metadata
Assignees
Labels
No labels