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

Using this in the browser? #21

Open
trusktr opened this issue Mar 18, 2018 · 1 comment
Open

Using this in the browser? #21

trusktr opened this issue Mar 18, 2018 · 1 comment

Comments

@trusktr
Copy link

trusktr commented Mar 18, 2018

Could there be a viable use case for using undom in the browser, to have a DOM-like API, but avoiding the performance cost of the real DOM?

Suppose, for example, we take something like A-Frame that gives us Custom Elements, but the purpose of those elements is to render to WebGL, and we actually don't need any DOM rendering. A-Frame is using DOM just for state management and as a component system, which makes it compatible with all the gazillion libraries that work with DOM (React, Vue, Angular, etc), making it possible to write declarative 3D WebGL scenes powered by Three.js under the hood.

Would it be possible to by-pass the real DOM and use undom with A-Frame, for example, in order to possibly gain a performance improvement from using a pure-JavaScript DOM? For example, would it be possible to use React and A-Frame in the browser, and actually render to WebGL? It would be interesting to see how this can improve performance, if it is possible.

@developit
Copy link
Owner

developit commented Apr 24, 2018

Hiya @trusktr! I've used Undom for that exact use-case. In the case of A-Frame, it's already possible to accomplish this in the browser by using a disconnected DOM:

const document = new DOMParser().parseFromString('<div id="base"></div>', 'text/html')
const base = document.getElementById('base')

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

No branches or pull requests

2 participants