Fix unit tests in firefox 4 and opera 11, passing null or undefined to indexOf was throwing an error in those browsers
This commit is contained in:
parent
6591f6dd9d
commit
eb857e2b71
1 changed files with 6 additions and 1 deletions
|
@ -298,13 +298,18 @@ jQuery.extend({
|
||||||
|
|
||||||
// Implement the identical functionality for filter and not
|
// Implement the identical functionality for filter and not
|
||||||
function winnow( elements, qualifier, keep ) {
|
function winnow( elements, qualifier, keep ) {
|
||||||
|
|
||||||
|
// Can't pass null or undefined to indexOf in Firefox 4
|
||||||
|
// Set to 0 to skip string check
|
||||||
|
qualifier = qualifier || 0;
|
||||||
|
|
||||||
if ( jQuery.isFunction( qualifier ) ) {
|
if ( jQuery.isFunction( qualifier ) ) {
|
||||||
return jQuery.grep(elements, function( elem, i ) {
|
return jQuery.grep(elements, function( elem, i ) {
|
||||||
var retVal = !!qualifier.call( elem, i, elem );
|
var retVal = !!qualifier.call( elem, i, elem );
|
||||||
return retVal === keep;
|
return retVal === keep;
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if ( qualifier && qualifier.nodeType ) {
|
} else if ( qualifier.nodeType ) {
|
||||||
return jQuery.grep(elements, function( elem, i ) {
|
return jQuery.grep(elements, function( elem, i ) {
|
||||||
return (elem === qualifier) === keep;
|
return (elem === qualifier) === keep;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue