如何在 Google Chrome 中使用自定义元素 v1 扩展 <form>?

How to extend <form> using Custom Elements v1 in Google Chrome?

我尝试定义一个新的自定义元素扩展 HTMLFormElement,例如:

class PrintableFormElement extends HTMLFormElement {
  constructor() {
    super();
    console.log("created: ", this);
  }
  print() { console.log(this.elements)); }
}
customElements.define("printable-form", PrintableFormElement, { extends: "form" });

这不正确。 <form is="printable-form" ...> 没有 print() 方法(define(...) 似乎失败了),new PrintableFormElement 失败并出现错误 Google Chrome 55.

new PrintableFormElement 抛出以下错误:

Uncaught TypeError: Illegal constructor
    at PrintableFormElement (<anonymous>:3:5)
    at <anonymous>:1:1

我不知道如何在当前 Google Chrome.

中定义使用自定义元素 v1 扩展的自定义元素

Custom Elements v0 效果很好,但我想使用它。

自定义内置元素 "v1" 尚未在 Chrome 中实现,您应该使用 polyfill.

有关更多详细信息,另请参阅来自 SO 的这个问题:

  • How to create new instance of an extended class of custom elements