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 模拟,并定义 customElements 全局变量。仅实现了定义和注册组件所需的最小 DOM 接口。这些包括一些关键的 DOM 类和一个大致功能正常的 CustomElementRegistry

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

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