I've struggled and hacked this Javascript into working:
function mmlfunc(name, evalcallback, mmlparts)
{
this.name = name;
// ...
}
mmlfunc.prototype.evalFunc = function()
{
return this.evalcallback(this.args);
};
mmlfunc.prototype.getMML = function()
{
var mml = this.mmlparts[0];
// ...
return mml;
}
// ...
mmlnum = jQuery.extend(true, {},
new mmlfunc('Value',
function() { return this.val; },
[ '<mn>', '</mn>' ]));
mmlnum.getMML = function()
{
return this.mmlparts[0] + this.val + this.mmlparts[1];
}
// ...
var n1 = jQuery.extend(true, {}, mmlnum),
n2 = jQuery.extend(true, {}, mmlnum),
n3 = jQuery.extend(true, {}, mmlnum),
n4 = jQuery.extend(true, {}, mmlnum);
n1.val = 6;
n2.val = 7;
n3.val = 8;
n4.val = 9;
How do I get new() working on n1-n4 instead of having to use extend()? What else can I do to clean this mess up?
Thanks.