element-worklet
element-worklet copied to clipboard
Opportunity to leave out the bad parts of DOM.
The article mentions
What DOM APIs should be available to Element Worklet code? Can WorkletElement provide a sufficient API surface to allow current libraries and approaches to be reused with minimal modification?
This made me think that element worklets may provide an opportunity to provide only a subset of DOM APIs: only the good parts based on decades of learnings from main-thread DOM, dropping the bad parts.
Absolutely. There are a number of DOM warts that could be intentionally omitted from a layout-less threaded DOM API:
- no cross-realm append / importNode
- no DOM-based scripting (event handler attributes,
<script>, document.write, etc) - no parser-only behaviors (invalid nesting correction, head coercion, etc)
- no global handlers
- required (or implied) strict containment
- maybe no namespaces? (would need something for svg)