Olical / react-faux-dom

DOM like structure that renders to React (unmaintained, archived)
http://oli.me.uk/2015/09/09/d3-within-react-the-right-way/
The Unlicense
1.21k stars 87 forks source link

Factor out non-React faux DOM into separate project? #61

Closed jfsiii closed 8 years ago

jfsiii commented 8 years ago

This a lightweight alternative to jsdom for rendering d3 but assumes/requires React.

Perhaps the non-React bits could be factored out into a separate project (faux-dom? d3-faux-dom?) and then build react-faux-dom on that.

I'm not intimately familiar with the code, but it seems like this lib could import d3-faux-dom and then decorate Element.prototype with toReact, add the mixins, etc.

Olical commented 8 years ago

I feel like this is too specific to advertise as a lightweight version of jsdom, it doesn't come close to the support jsdom provides. It is intended to help you bridge React and D3, that's all I'm afraid.

If people added support for other mutative DOM libraries, like a calendar script for example, then support of the DOM API would grow rapidly. After that sort of thing it'd begin to make more sense to advertise the project as something more general.

Right now the faux DOM tree that is mutated is extremely bare bones and represents data that is easy to turn into React elements, but not necessarily anything else.

I will bear this issue in mind going forward, thank you.

jfsiii commented 8 years ago

I wanted to use this for a d3 project, but it requires React.

AFAICT, it only requires React for the the .toReact method. It'd be nice if it was possible to use this without requiring React as well.

Olical commented 8 years ago

Ah, I see. I honestly think you'll be better off using jsdom though if you don't need React. This won't change an awful lot going forward (I hope), maybe a React-less fork would be the best approach? It means you can take the infrastructure (tests etc with some modification) and then delete a few lines.

It's a good idea to abstract this out, but it's outside of what I want to be doing with the project right now I'm afraid. If I decided to do this it wouldn't be for a while anyway, I really hope this isn't a blocker for you! :)

jfsiii commented 8 years ago

No, not a blocker. Just a thought.

There's a related discussion in a related project at https://github.com/developit/undom/issues/3