したがって、入力引数を使用して HTMLButtonElement のコンストラクターを再定義します。引数なしでこれを行う方法を知っています:
var CButtonPrototype = Object.create(HTMLButtonElement.prototype);
CButtonPrototype.createdCallback = function()
{
alert("call");
this.setAttribute("class", "some class");
this.value = 0;
this.innerHTML = "some text";
};
var CButton = document.registerElement('cbutton', {
prototype: CButtonPrototype
});
var myButton = new CButton();
それは機能しますが、このクラスを次のように使用したいと思いますvar myButton = new CButton(arg 1, arg 2, etc);
。この方法ではできませんCButtonPrototype.createdCallback = function(arg 1, arg2)
。どうすればこれを解決できますか? 多分あなたは別の方法を知っていますか?
ありがとう\o/