Prototype also does not play nicely with the google maps api, or is it
that the google maps api doesn''t play nicely with prototype? :)
I''m guessing now that more people are using javascript to it''s
"full"
potential then we may be seeing a lot more of these compatibility
problems.
On 10/13/05, SPENDLOVE, Matt, FM <Matt.SPENDLOVE@rbos.com>
wrote:> Apparently this is fixed in a later version of prototype. I
couldn''t upgrade
> so I changed the loop style, same way as you.
>
> Matt
>
> > -----Original Message-----
> > From: rails-spinoffs-bounces@lists.rubyonrails.org
> > [mailto:rails-spinoffs-bounces@lists.rubyonrails.org] On
> > Behalf Of Sylvain Wallez
> > Sent: 13 October 2005 13:24
> > To: rails-spinoffs@lists.rubyonrails.org
> > Subject: [Rails-spinoffs] Tweaks of Array.prototype
> >
> >
> > Hi all,
> >
> > I encountered a big problem when trying to use Scriptaculous and
> > Htmlarea in the same page.
> >
> > The Htmlarea code uses a lot of "for (var i in
array_variable)" to
> > iterate on array elements. Problem is that prototype.js augments
> > Array.prototype, which then show up in the iteration,
> > severely breaking
> > htmlarea.
> >
> > The easy workaround is for sure to use "for (var i = 0; i <
> > array_variable.length; i++)" but that doesn''t look
satisfying as it
> > requires to update the 3rd party code.
> >
> > I assume I''m not the first one to have this problem, so how
> > do you guys
> > handle this?
> >
> > Sylvain
> >
> > --
> > Sylvain Wallez Anyware Technologies
> > http://people.apache.org/~sylvain http://www.anyware-tech.com
> > Apache Software Foundation Member Research & Technology
Director
> >
> > _______________________________________________
> > Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
>
>
>
>
> ---------- Forwarded message ----------
> From: "SPENDLOVE, Matt, FM" <Matt.SPENDLOVE@rbos.com>
> To: "''rails-spinoffs@lists.rubyonrails.org''"
<rails-spinoffs@lists.rubyonrails.org>
> Date: Thu, 22 Sep 2005 13:45:01 +0100
> Subject: [Rails-spinoffs] Prototype lib : for-each loops and DontEnum
> All
>
> I realise that this isn''t strictly the correct place to discuss
the
> prototype lib but being as scriptaculous is dependent on it I thought
people
> might have some opinions.
>
> Easier to explain with the example below, copy into a html file and ensure
> the path to prototype.js is correct. You''ll see the first example
prints an
> extra element "extend" when iterating over the Array using a
for-each loop..
>
> - Problem
>
> In a nutshell, because prototype adds an extra member variable to the
Object
> type (extend), it kinda breaks the for-each loop (for x in y) for all
> implicit js objects e.g. Array, presumable because they extend Object.
>
> Some code we use (perhaps incorrectly) assumes all members within a custom
> object are things that it''s interested in. The addition of the
"extend"
> variable breaks things.
>
> We use Struts and it''s validator framework falls into this trap.
>
> - Solution
>
> Well, it''s hacky but we skip members called "extend".
Reading the ECMAScript
> spec and various things on the web (see links) I can see that the language
> spec sets it''s own internal variables (e.g. length ) with a
property called
> DontEnum which excludes them from a for-each. Unfortunately, there
doesn''t
> seem to be an api to set this yourself :(
>
> - Links
>
>
<http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf>
> - ECMAScript Spec
> <http://bclary.com/2004/09/26/boot-camp-javascript> - Excellent
language
> overview
>
> Any thought / opinions or suggestions welcome.
>
> Matt
>
>
>
----------------------------------------------------------------------------
> ------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"
> />
> <meta http-equiv="imagetoolbar" content="no"
/>
> <title>:::: Test ::::</title>
> <!--
> <link rel="stylesheet" type="text/css"
href="style/polymorphic.css"
> />
> -->
> </head>
> <body>
>
> <script src="javascript/prototype.js"
type="text/javascript"></script>
> <!--
> <script src="javascript/effects.js"
type="text/javascript"></script>
> <script src="javascript/dragdrop.js"
type="text/javascript"></script>
> <script src="javascript/controls.js"
type="text/javascript"></script>
> -->
> <script type="text/javascript">
>
>
> document.writeln("<br /><br /> Array Test ");
>
> var o = new Array("1","2","3");
>
> document.writeln("<br /><br /> test array contents =
["+o+"]");
>
> document.writeln("<br /> c style for loop");
> for (var i = 0; i < o.length; i++)
> {
> document.writeln("<br /> i["+i+"] =
["+o[i]+"]");
> }
>
> document.writeln("<br /> for each loop");
> for (var j in o)
> {
> document.writeln("<br /> j = ["+j+"]");
> }
>
> document.writeln("<br /><br /> Native Object Test ");
>
> var p = new Object();
>
> p.a = "a";
> p.b = "b";
> p.c = "c";
>
>
>
> document.writeln("<br /><br /> test object contents =
["+p+"]");
>
> document.writeln("<br /> c style for loop");
> for (var i = 0; i < p.length; i++)
> {
> document.writeln("<br /> i["+i+"] =
["+p[i]+"]");
> }
>
> document.writeln("<br /> for each loop");
> for (var j in p)
> {
> document.writeln("<br /> j = ["+j+"]");
> }
>
>
> document.writeln("<br /><br /> Prototype Object Test
");
>
> var TestClass = Class.create();
>
>
> TestClass.prototype > {
> initialize: function(arg1,arg2,arg3)
> {
>
> this.a = arg1;
> this.b = arg2;
> this.c = arg3;
> },
>
> showMessage: function(msg)
> {
> alert(msg);
> },
>
>
> forToString: function()
> {
> document.writeln("<br /> c style for loop");
> for (var i = 0; i < this.length; i++)
> {
> document.writeln("<br /> i["+i+"] =
["+this[i]+"]");
> }
>
> },
>
> forEachToString: function()
> {
> document.writeln("<br /> for each loop");
> for (var j in this)
> {
> document.writeln("<br /> j =
["+j+"]");
> }
> }
>
> };
>
> var q = new TestClass("a","b","c");
>
>
> document.writeln("<br /><br /> test object contents =
["+q+"]");
> q.forToString();
> q.forEachToString();
>
> </script>
>
> </body>
> </html>
>
----------------------------------------------------------------------------
> ------
>
>
>
****************************************************************************
> *******
> The Royal Bank of Scotland plc. Registered in Scotland No 90312.
> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
>
> Authorised and regulated by the Financial Services Authority
>
> This e-mail message is confidential and for use by the
> addressee only. If the message is received by anyone other
> than the addressee, please return the message to the sender
> by replying to it and then delete the message from your
> computer. Internet e-mails are not necessarily secure. The
> Royal Bank of Scotland plc does not accept responsibility for
> changes made to this message after it was sent.
>
>
>
> Whilst all reasonable care has been taken to avoid the
> transmission of viruses, it is the responsibility of the recipient to
>
> ensure that the onward transmission, opening or use of this
> message and any attachments will not adversely affect its
> systems or data. No responsibility is accepted by The Royal
> Bank of Scotland plc in this regard and the recipient should carry
> out such virus and other checks as it considers appropriate.
>
> Visit our websites at:
>
> http://www.rbs.co.uk/CBFM
>
> http://www.rbsmarkets.com
>
>
>
****************************************************************************
> ****
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>
> ---------- Forwarded message ----------
> From: "SPENDLOVE, Matt, FM" <Matt.SPENDLOVE@rbos.com>
> To: ''Rob Wills'' <rob.wills@gmail.com>,
"''rails-spinoffs@lists.rubyonrails.org''"
<rails-spinoffs@lists.rubyonrails.org>
> Date: Thu, 22 Sep 2005 15:12:11 +0100
> Subject: RE: [Rails-spinoffs] Prototype lib : for-each loops and DontEnum
> Scriptaculous 1.0
> Prototype 1.3.1
>
> I guess that explains things. Not sure I have time to integrate / test a
pre
> release version though before my next app release :(
>
> Thanks to all
>
> Matt
>
> > -----Original Message-----
> > From: rails-spinoffs-bounces@lists.rubyonrails.org
> > [mailto:rails-spinoffs-bounces@lists.rubyonrails.org] On
> > Behalf Of Rob Wills
> > Sent: 22 September 2005 14:04
> > To: rails-spinoffs@lists.rubyonrails.org
> > Subject: Re: [Rails-spinoffs] Prototype lib : for-each loops
> > and DontEnum
> >
> >
> > On 22/09/05, SPENDLOVE, Matt, FM <Matt.SPENDLOVE@rbos.com>
wrote:
> > >
> > > Easier to explain with the example below, copy into a html file
and
> > > ensure the path to prototype.js is correct. You''ll see
the first
> > > example prints an extra element "extend" when iterating
> > over the Array
> > > using a for-each loop..
> > >
> >
> >
> > >
> > > Any thought / opinions or suggestions welcome.
> > >
> >
> > Matt, what version of prototype are you using?
> >
> > I had the exact same problem with the additional
''extend''
> > attribute, until prototype was upgraded recently (in the last
> > few months).
> >
> > You might notice the section commented out at line 35 of
> > prototype.js version 1.4.0_pre2 ...
> >
> > /*
> > Object.prototype.extend = function(object) {
> > return Object.extend.apply(this, [this, object]);
> > }
> > */
> >
> > Cheers,
> >
> > Rob
> > _______________________________________________
> > Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
>
>
>
****************************************************************************
> *******
> The Royal Bank of Scotland plc. Registered in Scotland No 90312.
> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
>
> Authorised and regulated by the Financial Services Authority
>
> This e-mail message is confidential and for use by the
> addressee only. If the message is received by anyone other
> than the addressee, please return the message to the sender
> by replying to it and then delete the message from your
> computer. Internet e-mails are not necessarily secure. The
> Royal Bank of Scotland plc does not accept responsibility for
> changes made to this message after it was sent.
>
>
>
> Whilst all reasonable care has been taken to avoid the
> transmission of viruses, it is the responsibility of the recipient to
>
> ensure that the onward transmission, opening or use of this
> message and any attachments will not adversely affect its
> systems or data. No responsibility is accepted by The Royal
> Bank of Scotland plc in this regard and the recipient should carry
> out such virus and other checks as it considers appropriate.
>
> Visit our websites at:
>
> http://www.rbs.co.uk/CBFM
>
> http://www.rbsmarkets.com
>
>
>
****************************************************************************
> ****
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>