snabbdom / snabbdom

A virtual DOM library with focus on simplicity, modularity, powerful features and performance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: allow configurable window/document instance

iambumblehead opened this issue · comments

snabbdom is awesome and it would be great if configurable window and document instances could be passed into snabbdom like this,

import { JSDOM } from 'jsdom'
import snabbdom from 'snabbdom'

const dom = new JSDOM(`<!DOCTYPE html><body><div id="container"></div></body>`)
const patch = snabbdom.init([], dom.window, dom.window.document)

// ...

This would allow applications using snabbdom to run concurrent unit-tests, where each test uses separate local dom instances.

Also, snabbdom's ci badge shows a "failing" state and ci relies on browser stack. Snabbdom could be updated with unit-tests that use scripted dom instances that can run locally do not rely on third parties

          BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
          BROWSER_STACK_ACCESS_KEY: ${{ secrets. BROWSER_STACK_ACCESS_KEY }}

Also also, it would be great if snabbdom's main module file would be named with an .mjs extension, so that it could be imported directly with module type packages,

  "main": "build/snabbdom.cjs.js",
-  "module": "build/index.js",
+  "module": "build/index.mjs",