@miaskiewicz/turbo-dom 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/package.json +1 -1
- package/turbo-dom-parser.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -15,8 +15,10 @@ npm install -D @miaskiewicz/turbo-dom
|
|
|
15
15
|
- ✅ **More compatible than happy-dom** — 99.72% on html5lib-tests vs happy-dom's 37%.
|
|
16
16
|
Runs React Testing Library, `user-event`, downshift, Radix UI, and Headless UI unmodified.
|
|
17
17
|
- ⚡ **Faster than both** — ~120× jsdom / ~40× happy-dom on a realistic suite (parse-memoized repeated shells), 18–37× faster HTML parsing, and it beats happy-dom on repeated queries while staying 99.7% spec-correct.
|
|
18
|
-
- 🎯 **Honest, not lying** — no fake layout numbers; `getBoundingClientRect()` is zeros
|
|
19
|
-
`getComputedStyle`
|
|
18
|
+
- 🎯 **Honest, not lying** — no fake layout numbers; `getBoundingClientRect()` is zeros.
|
|
19
|
+
`getComputedStyle` runs a **partial cascade**: it resolves real injected `<style>` rules
|
|
20
|
+
(emotion/MUI `.css-HASH{…}`) + inline styles with proper specificity/source order — but only
|
|
21
|
+
ever returns values a real rule set, never invented layout. Geometry tests belong in a real browser.
|
|
20
22
|
|
|
21
23
|
## Quick start
|
|
22
24
|
|
|
@@ -90,7 +92,8 @@ parseFragment('<rect/>', 'svg path'); // fragment in a context elem
|
|
|
90
92
|
| html5lib-tests conformance | **99.72%** | 37.35% | 97.03% |
|
|
91
93
|
| @testing-library/dom + user-event | ✅ | ✅ | ✅ |
|
|
92
94
|
| React + Radix / Headless UI / downshift | ✅ | partial | ✅ |
|
|
93
|
-
| Real layout
|
|
95
|
+
| Real layout | ❌ (honest stub) | partial | partial |
|
|
96
|
+
| `getComputedStyle` cascade | partial (real `<style>` + inline) | partial | partial |
|
|
94
97
|
|
|
95
98
|
turbo-dom inherits Servo's tree constructor, so the "messy input" cases hand-rolled parsers
|
|
96
99
|
get wrong — adoption-agency reparenting (`<a><p></a></p>`), table foster-parenting, optional
|
|
@@ -151,9 +154,15 @@ JS (chatty, fine-grained) but pays only for what a test touches. Full design not
|
|
|
151
154
|
## Limitations (by design)
|
|
152
155
|
|
|
153
156
|
- **No layout.** `getBoundingClientRect()` returns zeros; `getClientRects()` is empty.
|
|
154
|
-
- **`getComputedStyle` is
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
- **`getComputedStyle` is a partial cascade** — it resolves REAL injected `<style>` rules
|
|
158
|
+
(emotion/MUI `.css-HASH{…}`) plus inline `style`, applying specificity and source order
|
|
159
|
+
(inline wins). It expands common shorthands to longhands (`margin`/`padding`/`border`/single-token
|
|
160
|
+
`background`), serializes bare `0` as `0px` for length props, and normalizes `font-family`
|
|
161
|
+
comma spacing to match browser output. Out of scope (returns `''`): `@media`/`@supports`/
|
|
162
|
+
`@keyframes`, `:hover`/state pseudo-classes, pseudo-elements, full inheritance, CSS custom
|
|
163
|
+
properties, and length-unit conversion (`em`/`rem`→`px`). Only ever returns values from a
|
|
164
|
+
matched rule or inline declaration — never an invented one. Style/geometry assertions belong
|
|
165
|
+
in a real browser (Playwright/WebDriver).
|
|
157
166
|
- Canvas, `<select>` rendering, and similar visual APIs are honest no-op stubs.
|
|
158
167
|
|
|
159
168
|
## Development
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miaskiewicz/turbo-dom",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "Faster, more spec-correct DOM for test runners — native html5ever (Rust/WASM) parser + lazy copy-on-write DOM. A drop-in-style alternative to jsdom/happy-dom for vitest & jest.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
Binary file
|