你正在查看 Lit 的旧版本文档。点击 这里查看最新版本。

Lit SSR DOM 模拟

This package is part of the Lit Labs family of experimental packages. See the Lit Labs page for guidance on using Labs software in production.

在 Node 中运行时,Lit 会自动导入并使用一组 DOM shim,并定义 customElements 全局变量。仅实现了定义和注册组件所需的最少量 DOM 接口,包括一些关键的 DOM 类和一个大致可用的 CustomElementRegistry

✅ 表示该项的功能实现与浏览器中相同。

属性备注
Element⚠️ 部分实现
attributes
shadowRoot⚠️ 如果使用 {mode: 'open'} 调用了 attachShadow(),则返回 {host: this}
setAttribute()
removeAttribute()
hasAttribute()
attachShadow()⚠️ 返回 {host: this}
getAttribute()
HTMLElement⚠️ 空类
CustomElementRegistry
define()
get()
customElementsCustomElementRegistry 的实例