2
私は新しいカスタム要素がHTMLFormElementのような拡張を定義しようとしました:これは、右動作しませんGoogle Chromeでカスタム要素v1を使用して<form>を拡張するにはどうすればよいですか?
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を使用します。
カスタム要素v0は正常に機能しますが、使いたいです。