Added support for comma-separated .is(), touched up the test cases. Resolves #977.

This commit is contained in:
John Resig 2007-03-24 02:44:41 +00:00
parent 6d03f9290e
commit e2b52e1e40
2 changed files with 5 additions and 5 deletions

View file

@ -576,10 +576,10 @@ test("is(String)", function() {
ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' ); ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
// test is() with comma-seperated expressions // test is() with comma-seperated expressions
ok( $('#en').is('[@lang="en"],[@lang="de"]'), 'Check for lang attribute: Expecte en or de' ); ok( $('#en').is('[@lang="en"],[@lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
ok( $('#en').is('[@lang="de"],[@lang="en"]'), 'Check for lang attribute: Expecte en or de' ); ok( $('#en').is('[@lang="de"],[@lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
ok( $('#en').is('[@lang="en"] , [@lang="de"]'), 'Check for lang attribute: Expecte en or de' ); ok( $('#en').is('[@lang="en"] , [@lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
ok( $('#en').is('[@lang="de"] , [@lang="en"]'), 'Check for lang attribute: Expecte en or de' ); ok( $('#en').is('[@lang="de"] , [@lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
}); });
test("$.extend(Object, Object)", function() { test("$.extend(Object, Object)", function() {

View file

@ -1041,7 +1041,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing * @cat DOM/Traversing
*/ */
is: function(expr) { is: function(expr) {
return expr ? jQuery.filter(expr,this).r.length > 0 : false; return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
}, },
/** /**