Skip to content

Commit

Permalink
Merge conflict in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Apr 17, 2011
2 parents 772c1f6 + 69ecd01 commit 4bcc097
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Discussion:
http://groups.google.com/group/sizzlejs

Documentation:
http://wiki.github.com/jeresig/sizzle
http://wiki.github.com/jquery/sizzle

Testing Sizzle:
- Open test/index.html in your browser to run the tests.
Expand Down
25 changes: 16 additions & 9 deletions sizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,42 +625,49 @@ var Expr = Sizzle.selectors = {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return "text" === type && ( attr === type || attr === null );
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},

radio: function( elem ) {
return "radio" === elem.type;
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},

checkbox: function( elem ) {
return "checkbox" === elem.type;
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},

file: function( elem ) {
return "file" === elem.type;
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},

password: function( elem ) {
return "password" === elem.type;
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},

submit: function( elem ) {
return "submit" === elem.type;
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},

image: function( elem ) {
return "image" === elem.type;
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},

reset: function( elem ) {
return "reset" === elem.type;
return elem.nodeName.toLowerCase() === "input" && "reset" === elem.type;
},

button: function( elem ) {
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},

input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},

focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
Expand Down
20 changes: 19 additions & 1 deletion test/unit/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ test("pseudo - child", function() {
});

test("pseudo - misc", function() {
expect(7);
expect(10);

t( "Headers", ":header", ["qunit-header", "qunit-banner", "qunit-userAgent"] );
t( "Has Children - :has()", "p:has(a)", ["firstp","ap","en","sap"] );
Expand All @@ -419,6 +419,24 @@ test("pseudo - misc", function() {

t( "Text Contains", "a:contains(Google Groups (Link))", ["groups"] );
t( "Text Contains", "a:contains((Link))", ["groups"] );

var input = document.createElement("input");
input.type = "text";
input.id = "focus-input";

document.body.appendChild( input );

input.focus();

t( "Element focused", "input:focus", [ "focus-input" ] );

ok( (window.Sizzle || window.jQuery.find).matchesSelector( input, ":focus" ), ":focus Matches" );

input.blur();

ok( !(window.Sizzle || window.jQuery.find).matchesSelector( input, ":focus" ), ":focus Doesn't Match" );

document.body.removeChild( input );
});


Expand Down

0 comments on commit 4bcc097

Please sign in to comment.