Does anyone have any idea why Array.prototype.push() was removed from prototype?
Isn''t the native Array object''s push() method already supported by browsers? (As in, it doesn''t need to be redefined by Prototype) On 6/10/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote:> Does anyone have any idea why Array.prototype.push() was removed from prototype? > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Yeah, it is, but IE 5 & I think 5.5 don't have it.... Prototype 1.3.1 (I think?) had it :) -----Original Message----- From: rails-spinoffs-bounces@lists.rubyonrails.org [mailto:rails-spinoffs-bounces@lists.rubyonrails.org]On Behalf Of Ed C. Sent: Saturday, June 10, 2006 9:14 PM To: rails-spinoffs@lists.rubyonrails.org Subject: Re: [Rails-spinoffs] Array.prototype.push() Isn't the native Array object's push() method already supported by browsers? (As in, it doesn't need to be redefined by Prototype) On 6/10/06, Maninder, Singh <mandiv@corp.untd.com> wrote:> Does anyone have any idea why Array.prototype.push() was removed from prototype? > _______________________________________________ > 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 _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
IE 5 does not have it, but prototype does not work in IE 5 anyway. The for...in structure causes IE 5 to throw JS errors just by including prototype.js. IE 5.5 works fine and has array.push (I may be wrong, but I believe the only changes from 5.5 to 6 are changes in CSS support. 5 to 5.5 was a big change in all areas). So, there''s no need for array.push in prototype because it doesn''t add any browsers to the support list. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh > Sent: Sunday, June 11, 2006 11:44 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > Yeah, it is, but IE 5 & I think 5.5 don''t have it.... > > Prototype 1.3.1 (I think?) had it :) > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of EdC.> Sent: Saturday, June 10, 2006 9:14 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails-spinoffs] Array.prototype.push() > > > Isn''t the native Array object''s push() method already supported by > browsers? (As in, it doesn''t need to be redefined by Prototype) > > On 6/10/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote: > > Does anyone have any idea why Array.prototype.push() was removedfrom> prototype? > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks Greg. I know prototype doesn''t work on IE5. Neither does my application, but for some reason my decider page (ajax vs non-ajax) was including the prototype library and I got greedy to make just that page work with the call to prototype.js (even though nothing is called from that file). Was getting an error on the line with push() so came up with that question. :) -Mandy. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Gregory Hill Sent: Monday, June 12, 2006 8:16 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Array.prototype.push() IE 5 does not have it, but prototype does not work in IE 5 anyway. The for...in structure causes IE 5 to throw JS errors just by including prototype.js. IE 5.5 works fine and has array.push (I may be wrong, but I believe the only changes from 5.5 to 6 are changes in CSS support. 5 to 5.5 was a big change in all areas). So, there''s no need for array.push in prototype because it doesn''t add any browsers to the support list. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh > Sent: Sunday, June 11, 2006 11:44 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > Yeah, it is, but IE 5 & I think 5.5 don''t have it.... > > Prototype 1.3.1 (I think?) had it :) > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of EdC.> Sent: Saturday, June 10, 2006 9:14 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails-spinoffs] Array.prototype.push() > > > Isn''t the native Array object''s push() method already supported by > browsers? (As in, it doesn''t need to be redefined by Prototype) > > On 6/10/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote: > > Does anyone have any idea why Array.prototype.push() was removedfrom> prototype? > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Gotcha. If you fix it so that array.push works, it''ll throw another error. I kept fixing them until I got to the ''for el in array'' error, which I didn''t know how to fix. So, best not to include prototype.js if you want to support IE 5, or if you know some magic that makes the for...in work, then go nuts. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh > Sent: Monday, June 12, 2006 10:10 AM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > Thanks Greg. > > I know prototype doesn''t work on IE5. > > Neither does my application, but for some reason my decider page (ajaxvs> non-ajax) was including the prototype library and I got greedy to make > just that page work with the > call to prototype.js (even though nothing is called from that file).Was> getting an error on the line with push() so came up with thatquestion.> > :) > -Mandy. > > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of > Gregory Hill > Sent: Monday, June 12, 2006 8:16 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > > IE 5 does not have it, but prototype does not work in IE 5 anyway.The> for...in structure causes IE 5 to throw JS errors just by including > prototype.js. > > IE 5.5 works fine and has array.push (I may be wrong, but I believethe> only changes from 5.5 to 6 are changes in CSS support. 5 to 5.5 was a > big change in all areas). > > So, there''s no need for array.push in prototype because it doesn''t add > any browsers to the support list. > > Greg > > > -----Original Message----- > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs- > > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh > > Sent: Sunday, June 11, 2006 11:44 PM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > > > Yeah, it is, but IE 5 & I think 5.5 don''t have it.... > > > > Prototype 1.3.1 (I think?) had it :) > > > > -----Original Message----- > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Ed > C. > > Sent: Saturday, June 10, 2006 9:14 PM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: Re: [Rails-spinoffs] Array.prototype.push() > > > > > > Isn''t the native Array object''s push() method already supported by > > browsers? (As in, it doesn''t need to be redefined by Prototype) > > > > On 6/10/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote: > > > Does anyone have any idea why Array.prototype.push() was removed > from > > prototype? > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>Gotcha. If you fix it so that array.push works, it''ll throw another >error. I kept fixing them until I got to the ''for el in array'' error, >which I didn''t know how to fix. So, best not to include prototype.js if >you want to support IE 5, or if you know some magic that makes the >For...in work, then go nuts.I encountered one of these for/loop errors in prototype with IE 5.5. For some reason, a generated Array had a length property that 5.5 couldn''t read. Knowing that 5.5 *shouldn''t* have a problem with array length, (and not knowing what internal anomaly in the array was inducing this 5.5 behavior), I copied the array to a new variable, copied it back (overwriting the original). The loop worked fine after that. Sam
Well, what I was referring to is that IE 5 flatly refuses to load a file with a for...in loop in it, because it thinks it''s a syntax error. It throws a js error and doesn''t load the file. I suppose you could do a try... catch around it: try { document.write(''<script src="prototype.js"><\/script>''); } catch (e) { // this browser sucks!! } But I''m not sure if that will work or not. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Sam > Sent: Monday, June 12, 2006 11:51 AM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > >Gotcha. If you fix it so that array.push works, it''ll throw another > >error. I kept fixing them until I got to the ''for el in array''error,> >which I didn''t know how to fix. So, best not to include prototype.jsif> >you want to support IE 5, or if you know some magic that makes the > >For...in work, then go nuts. > > I encountered one of these for/loop errors in prototype with IE 5.5.For> some reason, a generated Array had a length property that 5.5 couldn''t > read. > > Knowing that 5.5 *shouldn''t* have a problem with array length, (andnot> knowing what internal anomaly in the array was inducing this 5.5 > behavior), > I copied the array to a new variable, copied it back (overwriting the > original). The loop worked fine after that. > > Sam > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
No no no, lads, if you''re trying to workaround a specific IE version (from v5 through v7), use conditional comments: http://www.quirksmode.org/css/condcom.html Like: <!--[if gt IE 5]> <script src="prototype.js"></script> <![endif]--> On 6/12/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote:> Well, what I was referring to is that IE 5 flatly refuses to load a file > with a for...in loop in it, because it thinks it''s a syntax error. It > throws a js error and doesn''t load the file. > > I suppose you could do a try... catch around it: > > try { > document.write(''<script src="prototype.js"><\/script>''); > } > catch (e) { > // this browser sucks!! > } > > But I''m not sure if that will work or not. > > Greg > > > -----Original Message----- > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs- > > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Sam > > Sent: Monday, June 12, 2006 11:51 AM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: RE: [Rails-spinoffs] Array.prototype.push() > > > > >Gotcha. If you fix it so that array.push works, it''ll throw another > > >error. I kept fixing them until I got to the ''for el in array'' > error, > > >which I didn''t know how to fix. So, best not to include prototype.js > if > > >you want to support IE 5, or if you know some magic that makes the > > >For...in work, then go nuts. > > > > I encountered one of these for/loop errors in prototype with IE 5.5. > For > > some reason, a generated Array had a length property that 5.5 couldn''t > > read. > > > > Knowing that 5.5 *shouldn''t* have a problem with array length, (and > not > > knowing what internal anomaly in the array was inducing this 5.5 > > behavior), > > I copied the array to a new variable, copied it back (overwriting the > > original). The loop worked fine after that. > > > > Sam > > > > > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Ed C. wrote:> No no no, lads, if you''re trying to workaround a specific IE version > (from v5 through v7), use conditional comments: > > http://www.quirksmode.org/css/condcom.html > > Like: > > <!--[if gt IE 5]> > <script src="prototype.js"></script> > <![endif]-->Except that will break any non-IE client. Those abominations should be avoided at all costs. And if you absolutely need to use them, it should probably be more like this: <![if lt IE 6]><comment><![endif]> <script src="prototype.js"></script> <![if lt IE 6]></comment><![endif]> That way at least browsers that don''t try to force functionality into comments will still see it. -- Michael Peters Developer Plus Three, LP