Commit 346ceacc authored by John Resig's avatar John Resig

Added support for a new :header psuedo-selector (only selects H1-H6 elements).

parent fbd2b066
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</head> </head>
<body id="body"> <body id="body">
<h1>jQuery Test Suite</h1> <h1 id="header">jQuery Test Suite</h1>
<h2 id="banner"></h2> <h2 id="banner"></h2>
<h2 id="userAgent"></h2> <h2 id="userAgent"></h2>
......
...@@ -56,7 +56,10 @@ jQuery.extend({ ...@@ -56,7 +56,10 @@ jQuery.extend({
input: "/input|select|textarea|button/i.test(a.nodeName)", input: "/input|select|textarea|button/i.test(a.nodeName)",
// :has() // :has()
has: "jQuery.find(m[3],a).length" has: "jQuery.find(m[3],a).length",
// :header
header: "/h\\d/i.test(a.nodeName)"
}, },
// DEPRECATED // DEPRECATED
"[": "jQuery.find(m[2],a).length" "[": "jQuery.find(m[2],a).length"
......
...@@ -163,7 +163,7 @@ test("attributes", function() { ...@@ -163,7 +163,7 @@ test("attributes", function() {
}); });
test("pseudo (:) selectors", function() { test("pseudo (:) selectors", function() {
expect(30); expect(31);
t( "First Child", "p:first-child", ["firstp","sndp"] ); t( "First Child", "p:first-child", ["firstp","sndp"] );
t( "Last Child", "p:last-child", ["sap"] ); t( "Last Child", "p:last-child", ["sap"] );
t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2"] ); t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2"] );
...@@ -196,6 +196,8 @@ test("pseudo (:) selectors", function() { ...@@ -196,6 +196,8 @@ test("pseudo (:) selectors", function() {
t( "Form element :radio:checked", ":radio:checked", ["radio2"] ); t( "Form element :radio:checked", ":radio:checked", ["radio2"] );
t( "Form element :checkbox:checked", ":checkbox:checked", ["check1"] ); t( "Form element :checkbox:checked", ":checkbox:checked", ["check1"] );
t( "Form element :checkbox:checked, :radio:checked", ":checkbox:checked, :radio:checked", ["check1", "radio2"] ); t( "Form element :checkbox:checked, :radio:checked", ":checkbox:checked, :radio:checked", ["check1", "radio2"] );
t( "Headers", ":header", ["header", "banner", "userAgent"] );
}); });
test("basic xpath", function() { test("basic xpath", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment