Hi Jim,

Yesterday Jim Hunter wrote:

> I have a large app that has not given me much trouble lately until
> this... I have a switch statement and when I just had code for the
> first item, the statement worked fine, when I added the exact same
> line to the second statment, the file fails to even load in the
> browser! Can someone take a quick look to see if I am overlooking an
> obvious mistake here? Here is the code that works fine:
>
>
>               switch (ofdShape)
>               {
>                       case "Rectangle" :
>                               eval("var " + id + " = this.paper.rect(" + (X * 
> ofdWidth) + ", " +
> (Y * ofdHeight) + ", nodeWidth, nodeHeight).attr({fill: fillColor,
> stroke: borderColor, 'stroke-width': 2})");
>                               break;
>                       case "RoundRect" :
>                       case "Diamond" :
>                       case "Ellipse" :
>               }
>
>
> and here is the code that breaks everything:
>
>
>               switch (ofdShape)
>               {
>                       case "Rectangle" :
>                               eval("var " + id + " = this.paper.rect(" + (X * 
> ofdWidth) + ", " +
> (Y * ofdHeight) + ", nodeWidth, nodeHeight).attr({fill: fillColor,
> stroke: borderColor, 'stroke-width': 2})");
>                               break;
>                       case "RoundRect" :
>                               eval("var " + id + " = this.paper.rect(" + (X * 
> ofdWidth) + ", " +
> (Y * ofdHeight) + ", nodeWidth, nodeHeight).attr({fill: fillColor,
> stroke: borderColor, 'stroke-width': 2})");
>                               break;
>                       case "Diamond" :
>                       case "Ellipse" :
>               }
>
> With the second piece of code, I just get a white screen in the
> browser when I try and start the program. When I look in FireBug, the
> JS file fails to complete the load process. If I go in to the build
> script and comment out the added line, the file loads fine. If I
> replace the line with something like 'alert("hello")' it works fine.
>
> This one has me scratching my head and I am totally stumped.

why it breaks, I don't know, but using eval like this a sub-optimal
aproach ... can't you use a map instead of conjuring up
variables on the fly ... I bet this will be very unhealthy for
performance as the eval bits would probably resist compilation

cheers
tobi


> Thanks,
> Jim
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to