Javascript CustomElementRegistry.whenDefined返回void而不是构造函数

Javascript CustomElementRegistry.whenDefined返回void而不是构造函数,javascript,custom-element,Javascript,Custom Element,假设定义了一个自定义元素,并使用CustomElements。定义时使用函数检查何时发生: customElements.whenDefined("foo-bar").then(console.log) customElements.define("foo-bar", class {}); 根据自定义elments规范()和MDN文档()中的CustomElements.When定义的将使用CustomElement的构造函数进行解析。但是当在chro

假设定义了一个自定义元素,并使用
CustomElements。定义时使用
函数检查何时发生:

customElements.whenDefined("foo-bar").then(console.log)

customElements.define("foo-bar", class {});
根据自定义elments规范()和MDN文档()中的
CustomElements.When定义的
将使用CustomElement的构造函数进行解析。但是当在chrome(86)或firefox(82)中运行上述代码时,它会记录
未定义的
。Microsoft对此方法()的类型定义也将其解析为“void”

customElements.get(“foo-bar”)
工作正常并返回构造函数。)

有人知道为什么吗?

问得好:问得好: