Hi, I am trying to use prototype.js on a JSP that also contains some javascript from Coremetrics (eluminate.js). Coremetrics is used for tracking marketing clicks. When I have both of these javascript imports on the page I get javascript errors in the eluminate.js file. I get javascript errors that say "Undeterminate string constant." It looks like the prototype.js file is somehow messing up the javascript code in eluminate.js. It is taking code like: img.onload=new Function("if(c6)c6(''"+host+"'',"+i +");");}else{img.onload=new Function("if(C0)C0("+i+");");} and turning it into: if(c6)c6(''function (iterator) { It seems like the values coming in for param "host" is not correct it is now somehow a method call...which has line breaks and I believe this is what is causing the "Undeterminate string constant" error. but how is prototype.js messing up that host variable. Anyone have any ideas what could be going on? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Nicolás Sanguinetti
2007-Sep-13 01:55 UTC
Re: Prototype.js and Coremetrics eluminate.js issues
I''m gonna shoot in the dark here, but I guess that host there comes from doing something like for (var i in someArray) { ... var host = someArray[i]; ... img.onload = new Function(...) ... } Now, if that''s the case, then it''s a problem on Coremetrics code. using for...in iterates over the object visible properties. It just happens that Array''s visible properties coincide with its elements'' indexes, so a lot of naive js programmers think that they can do for...in to iterate over an array (I know I did :)). But Prototype extends Array to add all the nice Enumerable methods (each, map, inject, first, etc), which ends up meaning that for...in, instead of doing for ({ 0, 1, 2, 3, 4 } in myArray) does something like for ({ 0, 1, 2, 3, 4, "_each", "each", "map".... } in myArray) which produces the behavior you''re observing. You should let Coremetrics know they''re at fault with their code and that they should improve. Best, -Nicolas On 9/12/07, brian <brianlschultz-uAjRD0nVeow@public.gmane.org> wrote:> > > Hi, > > I am trying to use prototype.js on a JSP that also contains some > javascript from Coremetrics (eluminate.js). Coremetrics is used for > tracking marketing clicks. > > When I have both of these javascript imports on the page I get > javascript errors in the eluminate.js file. I get javascript errors > that say "Undeterminate string constant." > > It looks like the prototype.js file is somehow messing up the > javascript code in eluminate.js. > > It is taking code like: > > img.onload=new Function("if(c6)c6(''"+host+"'',"+i > +");");}else{img.onload=new Function("if(C0)C0("+i+");");} > > and turning it into: > > if(c6)c6(''function (iterator) { > > It seems like the values coming in for param "host" is not correct it > is now somehow a method call...which has line breaks and I believe > this is what is causing the "Undeterminate string constant" error. but > how is prototype.js messing up that host variable. > > Anyone have any ideas what could be going on? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Howdy, This is an issue that we know about and have a fix available for (I work at Coremetrics). It just involves a newer version of the eluminate.js library. You can get in touch with the Coremetrics Customer Support group (support-6rJ9xhWzvN05UWNf+nJyDw@public.gmane.org) to request the most up-to-date version of eluminate. If you are an employee of the company using Coremetrics, we can give it to you directly. If you are fro ma third party company, please have the client contact support. I hope that helps. - Eliot - As as aside, this code was written 4+ years ago, so this wasn''t an issue until prototype.js started being used. That''s part of the fun of web development - ever moving targets! :-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---