$.fn.border = function(prefix){ var classNames = [ 'north', 'east', 'south', 'west', 'northeast', 'southeast', 'southwest', 'northwest']; return this.each(function(){ for (var index = 0; index < classNames.length; index++){ className = (prefix || '')+ classNames[index]; $(this).wrap("<div class='" + className + " block'></div>") } }) };
is now impervious to changes to the Array prototype! Thanks Michael & Blair! On 1/30/07, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote: > Ah yes.... then the array is not an array... I think we all agree that > it's a terrible practice! > > I guess when dealing with mixed libraries written in mixed styles, one > can still get burned! > > On 1/30/07, Blair Mitchelmore <[EMAIL PROTECTED]> wrote: > > Unless someone has custom code that extends the Array objects prototype > > property. Then those functions will become a part of the iteration. > > > > -blair > > > > Ⓙⓐⓚⓔ wrote: > > > it's safe when you know what's in the array, and you are sure it's not > > > an array-like object > > > > > > On 1/30/07, Michael Geary <[EMAIL PROTECTED]> wrote: > > >>> $.fn.border = function(prefix){ > > >>> var classNames = [ 'north', 'east', 'south', 'west', 'northeast', > > >> 'southeast', 'southwest', 'northwest']; > > >>> return this.each(function(){ > > >>> for (var index in classNames){ > > >>> className = (prefix || '')+ classNames[index]; > > >>> $(this).wrap("<div class='" + className + " block'></div>") > > >>> } > > >>> }) > > >>> }; > > >> Danger warning! Don't use for..in on an array! Use a C-style loop > > >> instead. > > >> > > > > > > _______________________________________________ > > jQuery mailing list > > discuss@jquery.com > > http://jquery.com/discuss/ > > > > > -- > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ > -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/