在 IE 11 中使用 babel 编译的 es6 class/webcomponents 访问静态方法

Access static method from es6 class/webcomponents compiled with babel in IE 11

我正在使用 es6 class 和 webcomponents 开发自定义 js 框架。 我正在尝试通过使用 babel 将我的代码编译为 es2015 并添加 webcomponents 库来支持 IE11。

class baseControl extends HTMLElement{
    static element(nodeName){
        // 'this' is the current class object
        return document.registerElement(nodeName, this);
    }
}

还有,我的问题的一个小例子:

class SubControl extends baseControl{
     static secondStaticMethod(){
          // some stuff
     }

}

SubControl
    .element("sub-control")
    .secondStaticMethod() //Object doesn't support property or method 'secondStaticMethod'

对于 IE11,"element" 调用运行良好,但无法识别 "secondStaticMethod" 函数。 我的猜测是 "registerElement" 函数不会复制我的 class

的静态方法

有没有办法绕过这个问题?

document.registerElement 已弃用。

customElements.define