So, I want redefine constructor of HTMLButtonElement with input args. I know how to do this without args:
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();
And it's works, but I want use this class something like var myButton = new CButton(arg 1, arg 2, etc);
. This method don't let me doing CButtonPrototype.createdCallback = function(arg 1, arg2)
. How can I resolve this? Maybe you know another way?
Thanks \o/
if you need to extend this type, please consider the following:
about your original question:
you can't insert parameters because this "function" is only a delegate to a system function... in your case - an object c'tor.
to test it you can try arguments - a special array inside every function in js that represents the arguments of the function:
run this code - you will see an empty array - mainly because your c'tor call 'new CButton()' has no arguments. try to insert arguments and you will get an error.