[Helma-user] helmaLib - Object.clone() - bug?

robert.gaggl at orf.at robert.gaggl at orf.at
Fri Mar 9 17:45:54 CET 2007


hi klemens,

looks like you have an old version of helma.Html, because i fixed this
bug two weeks ago (see
http://adele.helma.org/source/viewcvs.cgi/modules/helma/Html.js.diff?r1=
1.5&r2=1.6)

using param.clone() unfortunately isn't possible because the param
object might be one received from a macro, and these aren't JS objects
but a mapwrapper ones, which in turn don't inherit the
Object.prototype.clone() method. that's why i switched to calling
reduce(), which clones the object into a plain JS object.

so updating helma.Html to the current CVS version should solve your
problem.

robert
 

> -----Original Message-----
> From: helma-user-bounces at helma.org 
> [mailto:helma-user-bounces at helma.org] On Behalf Of Klemens Mantzos
> Sent: Friday, March 09, 2007 4:42 PM
> To: Helma User Mailing List
> Subject: [Helma-user] helmaLib - Object.clone() - bug?
> 
> Hi,
> 
> this bug is in helma 1.6 only (im using java 1.6.0_01-ea)...
> 
> the helmaLib Html.input() tries to clone the param attribute. 
> it uses the Object.clone() method (in a wrong way, i think):
> 
> helma.Html.js #229
>        var attr = Object.clone(param);
> 
> so it doesn't clone param.
> 
> a short example:
> var foo = {jo: "jo"};
> var bar = Object.clone(foo);
> res.debug(uneval(foo) + " - " + uneval(bar));
> 
> result:
> ({jo:"jo", prototype:{}}) - ({jo:"jo", prototype:{}})
> 
> when i use foo.clone() everything works fine.
> 
> so the solution is maybe:
> helma.Html.js #229
>        var attr = param.clone();
> 
> thx
> --
> klemens mantzos
> web developer | vienna - http://knallgrau.at - 
> http://twoday.net - http://blogr.com 
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
> 


More information about the Helma-user mailing list