Permalink
Browse files

Fix a strange Chrome issue

  • Loading branch information...
1 parent fa45f25 commit 52a02383fa521c51d9996a46f03a7080dd825f11 @wycats wycats committed Jan 14, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/traversing.js
View
@@ -196,7 +196,8 @@ jQuery.each({
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until );
+ var ret = jQuery.map( this, fn, until ),
+ args = slice.call(arguments);
if ( !runtil.test( name ) ) {
selector = until;
@@ -212,7 +213,7 @@ jQuery.each({
ret = ret.reverse();
}
- return this.pushStack( ret, name, slice.call(arguments).join(",") );
+ return this.pushStack( ret, name, args.join(",") );
};
});

8 comments on commit 52a0238

What was the issue ? It seems it has to be known for any JS developer :)

Contributor

jitter replied Jan 15, 2011

There seems to be no test case / ticket associated with this change. Also any information on why this was done is missing.

The only thing I was able to find is a single failing test in the jQuery test suite (before this change) but with the Chrome Dev version (10.something).
In Chrome Stable (8.something) and Chrome Beta (9.something) this change isn't needed.
This strange behavior should be filed as a bug against the Chrome bug tracker as to me it looks like a chrome bug not a jQuery bug.

Member

paulirish replied Jan 17, 2011

Here is the detail on the Chrome issue: http://code.google.com/p/v8/issues/detail?id=1050

It appeared in the latest dev channel and is live in the chromium nightlies.

We expect to see it fixed soon, so we'll be able to revert this commit once the dev channel comes through with an update.

ajpiano has added a pull req to document this: #186

So, the fix came through 6 months ago, but this commit with the "this should be removed" note is still in 1.6.2... Was this forgotten, or is there a reason for keeping it in there?

Member

paulirish replied Aug 6, 2011

@ajpiano see above.

Bump! Calendar has flipped 4 times through.

Member

gibson042 replied Aug 7, 2015

@LeadSongDog If you look at the current file, you will see that not only is this code gone, but that there's no longer any remnant of the functionality it was supporting:

jquery/src/traversing.js

Lines 171 to 195 in 9adfad1

jQuery.fn[ name ] = function( until, selector ) {
var matched = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
matched = jQuery.filter( selector, matched );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
jQuery.uniqueSort( matched );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
matched.reverse();
}
}
return this.pushStack( matched );
};

@gibson042 Thanks, I'm still new here and stumbling around.

Please sign in to comment.