WebReflection / uhtml

A micro HTML/SVG render
MIT License
916 stars 37 forks source link

uhtml/dom 🦄 #99

Closed WebReflection closed 10 months ago

WebReflection commented 10 months ago

This MR brings a specialized version of a DOM environment created ad hoc for uhtml internals and used to test uhtml itself, as opposite of using LinkeDOM which has way too many features and it's not strictly aligned with all the operations needed.

The specialized DOM is 1.5X faster than LinkeDOM and it uses 60% of the RAM so it's even more ideal for SSR or integration with other PLs such as Python (PyScript) or others.

The specialized DOM is not meant by any mean to be used as JSDOM or LinkeDOM replacement and it lacks tons of features but for most common SSR use cases it should be superior in RAM and performance by all means to any alternative I have tried, or even created, to date.

Please feel free to play around with what can work in a Web Worker, in any SSR logic, or to quickly parse and/or serve well formed HTML/SVG content, as well as to use this module to land uhtml templates with a proper DOM behind instead of dealing with scrings only, which is what uhtml-ssr does instead.

This module is meant to be 100% aligned by design with uhtml as the code coverage uses the module itself to test its own functionalities so, among other good things, there's that: it really enables uhtml on both server and workers space.