Merge branch '2773_firefox_opera_fix' of https://github.com/timmywil/jquery into timmywil-2773_firefox_opera_fix
This commit is contained in:
commit
e9905b15d4
|
@ -73,9 +73,9 @@ jQuery.fn.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
is: function( selector ) {
|
is: function( selector ) {
|
||||||
return !!selector && (typeof selector === "string" ?
|
return !!selector && ( typeof selector === "string" ?
|
||||||
jQuery.filter( selector, this ).length > 0 :
|
jQuery.filter( selector, this ).length > 0 :
|
||||||
this.filter( selector ).length > 0);
|
this.filter( selector ).length > 0 );
|
||||||
},
|
},
|
||||||
|
|
||||||
closest: function( selectors, context ) {
|
closest: function( selectors, context ) {
|
||||||
|
@ -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;
|
||||||
});
|
});
|
||||||
|
|
|
@ -72,7 +72,7 @@ test("is(String|undefined)", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("is(jQuery)", function() {
|
test("is(jQuery)", function() {
|
||||||
expect(24);
|
expect(23);
|
||||||
ok( jQuery('#form').is( jQuery('form') ), 'Check for element: A form is a form' );
|
ok( jQuery('#form').is( jQuery('form') ), 'Check for element: A form is a form' );
|
||||||
ok( !jQuery('#form').is( jQuery('div') ), 'Check for element: A form is not a div' );
|
ok( !jQuery('#form').is( jQuery('div') ), 'Check for element: A form is not a div' );
|
||||||
ok( jQuery('#mark').is( jQuery('.blog') ), 'Check for class: Expected class "blog"' );
|
ok( jQuery('#mark').is( jQuery('.blog') ), 'Check for class: Expected class "blog"' );
|
||||||
|
@ -83,7 +83,6 @@ test("is(jQuery)", function() {
|
||||||
ok( !jQuery('#en').is( jQuery('[lang="de"]') ), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
|
ok( !jQuery('#en').is( jQuery('[lang="de"]') ), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
|
||||||
ok( jQuery('#text1').is( jQuery('[type="text"]') ), 'Check for attribute: Expected attribute type to be "text"' );
|
ok( jQuery('#text1').is( jQuery('[type="text"]') ), 'Check for attribute: Expected attribute type to be "text"' );
|
||||||
ok( !jQuery('#text1').is( jQuery('[type="radio"]') ), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
|
ok( !jQuery('#text1').is( jQuery('[type="radio"]') ), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
|
||||||
ok( jQuery('#text2').is( jQuery(':disabled') ), 'Check for pseudoclass: Expected to be disabled' );
|
|
||||||
ok( !jQuery('#text1').is( jQuery(':disabled') ), 'Check for pseudoclass: Expected not disabled' );
|
ok( !jQuery('#text1').is( jQuery(':disabled') ), 'Check for pseudoclass: Expected not disabled' );
|
||||||
ok( jQuery('#radio2').is( jQuery(':checked') ), 'Check for pseudoclass: Expected to be checked' );
|
ok( jQuery('#radio2').is( jQuery(':checked') ), 'Check for pseudoclass: Expected to be checked' );
|
||||||
ok( !jQuery('#radio1').is( jQuery(':checked') ), 'Check for pseudoclass: Expected not checked' );
|
ok( !jQuery('#radio1').is( jQuery(':checked') ), 'Check for pseudoclass: Expected not checked' );
|
||||||
|
|
Loading…
Reference in a new issue