]> source.dussan.org Git - jquery.git/commitdiff
Added support for a new :header psuedo-selector (only selects H1-H6 elements).
authorJohn Resig <jeresig@gmail.com>
Fri, 31 Aug 2007 05:43:24 +0000 (05:43 +0000)
committerJohn Resig <jeresig@gmail.com>
Fri, 31 Aug 2007 05:43:24 +0000 (05:43 +0000)
build/test/index.html
src/selector/selector.js
src/selector/selectorTest.js

index 746c08ec980a0012f34792b50f34a01f6e31a0dd..6956cb90272545bec75268dd872bb626eb12117e 100644 (file)
@@ -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>
        
index 5fc3e0ed9e7caee87577bac81174f459bd433794..f75bae3c4756fe80d0d8c98ecd17269bc098a576 100644 (file)
@@ -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"
index 458804bbfe7fa7fcc23d676f5975a1127373ff23..9ae223309c8222466c25711997459cbe4f209551 100644 (file)
@@ -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() {