aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-08-31 05:43:24 +0000
committerJohn Resig <jeresig@gmail.com>2007-08-31 05:43:24 +0000
commit346ceacce3fb6f83701d742ce0835d4db0ba98aa (patch)
tree9935695f3c925ddda65987829c75d4a5a6411bd0
parentfbd2b066a71c8c2371e11f7f6b201a9000b564e4 (diff)
downloadjquery-346ceacce3fb6f83701d742ce0835d4db0ba98aa.tar.gz
jquery-346ceacce3fb6f83701d742ce0835d4db0ba98aa.zip
Added support for a new :header psuedo-selector (only selects H1-H6 elements).
-rw-r--r--build/test/index.html2
-rw-r--r--src/selector/selector.js5
-rw-r--r--src/selector/selectorTest.js4
3 files changed, 8 insertions, 3 deletions
diff --git a/build/test/index.html b/build/test/index.html
index 746c08ec9..6956cb902 100644
--- a/build/test/index.html
+++ b/build/test/index.html
@@ -14,7 +14,7 @@
</head>
<body id="body">
- <h1>jQuery Test Suite</h1>
+ <h1 id="header">jQuery Test Suite</h1>
<h2 id="banner"></h2>
<h2 id="userAgent"></h2>
diff --git a/src/selector/selector.js b/src/selector/selector.js
index 5fc3e0ed9..f75bae3c4 100644
--- a/src/selector/selector.js
+++ b/src/selector/selector.js
@@ -56,7 +56,10 @@ jQuery.extend({
input: "/input|select|textarea|button/i.test(a.nodeName)",
// :has()
- has: "jQuery.find(m[3],a).length"
+ has: "jQuery.find(m[3],a).length",
+
+ // :header
+ header: "/h\\d/i.test(a.nodeName)"
},
// DEPRECATED
"[": "jQuery.find(m[2],a).length"
diff --git a/src/selector/selectorTest.js b/src/selector/selectorTest.js
index 458804bbf..9ae223309 100644
--- a/src/selector/selectorTest.js
+++ b/src/selector/selectorTest.js
@@ -163,7 +163,7 @@ test("attributes", function() {
});
test("pseudo (:) selectors", function() {
- expect(30);
+ expect(31);
t( "First Child", "p:first-child", ["firstp","sndp"] );
t( "Last Child", "p:last-child", ["sap"] );
t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2"] );
@@ -196,6 +196,8 @@ test("pseudo (:) selectors", function() {
t( "Form element :radio:checked", ":radio:checked", ["radio2"] );
t( "Form element :checkbox:checked", ":checkbox:checked", ["check1"] );
t( "Form element :checkbox:checked, :radio:checked", ":checkbox:checked, :radio:checked", ["check1", "radio2"] );
+
+ t( "Headers", ":header", ["header", "banner", "userAgent"] );
});
test("basic xpath", function() {