Just a curiosity, are you using indexOf with jQuery instances as well? In this case line 411 of core.js
inArray: Array.prototype.indexOf ? (function( indexOf ) { return function( elem, array ) { return indexOf.call( array, elem ); } })( Array.prototype.indexOf ) : function( elem, array ) { for ( var i = 0, length = array.length; i < length; i++ ) { if ( array[ i ] === elem ) { return i; } } return -1; } , otherwise if this function supposes to work only with array (due to explicit name) just this: inArray: Array.prototype.indexOf ? function( elem, array ) { return array.indexOf( elem ); } : function( elem, array ) { for ( var i = 0, length = array.length; i < length; i++ ) { if ( array[ i ] === elem ) { return i; } } return -1; } , I am sure they'll follow this logic so I would not worry about trunk. Regards On Thu, Sep 3, 2009 at 2:13 PM, lrbabe <lrb...@gmail.com> wrote: > > Nice Andrea. > > In such case it would be valuable to have jQuery on Git or another > DVCS. > I could simply pull from you instead of re-creating the patch for > myself, since I use inArray quite a lot in my project and don't want > to wait for this improvement to be committed to the trunk. Sizzle is > already on Github, why not jQuery? > Sorry, I'm even more OT... > > Louis-RĂ©mi > > On Sep 3, 12:42 pm, Andrea Giammarchi <andrea.giammar...@gmail.com> > wrote: > > Sorry guys, a little OT for jQuery developers: > > guys did you get the fact jQuery.inArray could be easily optimized? The > code > > I posted does not exist in the latest jQuery core.js file, you are using > the > > loop version for every browser - it's a quick improvement, I would go for > it > > :D > > > > On Thu, Sep 3, 2009 at 12:20 PM, ludovic <ludothebe...@gmail.com> wrote: > > > > > @THD > > > I agree with the principle of creating your own precompilation syntax, > > > but not to have a regression, it would be preferrable to use features > > > detection. > > > > > inArray = function( elem, array ) { > > > > > /* @if support indexOf > > > * Creates correct inArray function when browser does not support > > > native > > > array.indexOf > > > * Use === because on IE, window == document > > > */ > > > for ( var i = 0, length = array.length; i < length; i++ ) > > > if ( array[ i ] === elem ) > > > return i; > > > return -1; > > > /* @else */ > > > return array.indexOf(elem); > > > /* @ */ > > > } > > > > > And create a database of correspondances between features support and > > > browsers. Then, when you want to create your IE file, you search in > > > your correspondances what features are known to be supported by the IE > > > version, and then, excecute precomputation tests by replacing features > > > detection by the value. > > > > > It would cost much less work to make the migration of jquery as > > > features detection are already managed. > > > > > Regards, > > > Ludovic > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---