Added test to verify bug #160, had to modify fixture (index.html)
[jquery.git] / src / jquery / jquery.js
index b6bffc7..c1d64f2 100644 (file)
@@ -390,6 +390,8 @@ jQuery.fn = jQuery.prototype = {
         * @test ok( $('#en').attr('lang') == "en", 'Check for lang attribute' );
         * @test ok( $('#simon').attr('class') == "blog link", 'Check for class attribute' );
         * @test ok( $('#name').attr('name') == "name", 'Check for name attribute' );
+        * @test ok( $('#text1').attr('name') == "action", 'Check for name attribute' );
+        * @test ok( $('#form').attr('action') == "formaction", 'Check for action attribute' );
         * 
         * @name attr
         * @type Object
@@ -435,6 +437,10 @@ jQuery.fn = jQuery.prototype = {
         *
         * @test $("#name").attr('name', 'something');
         * ok( $("#name").name() == 'something', 'Set name attribute' );
+        * @test $("#check2").attr('checked', true);
+        * ok( document.getElementById('check2').checked == true, 'Set checked attribute' );
+        * $("#check2").attr('checked', false);
+        * ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
         *
         * @name attr
         * @type jQuery
@@ -1627,6 +1633,11 @@ jQuery.extend({
         * @test t( "Is Visible", "input:visible", ["text1","text2","radio1","radio2","check1","check2","name"] );
         * @test t( "Is Hidden", "input:hidden", ["hidden1","hidden2"] );
         *
+        * @test t( "Grouped Form Elements", "input[@name='foo[bar]']", ["hidden2"] );
+        *
+        * @test t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"]  );
+        * @test t( "All Children of ID with no children", "#firstUL/*", []  );
+        *
         * @name $.find
         * @type Array<Element>
         * @private
@@ -1746,7 +1757,7 @@ jQuery.extend({
                if ( fix[name] ) {
                        if ( value != undefined ) elem[fix[name]] = value;
                        return elem[fix[name]];
-               } else if ( elem.getAttribute ) {
+               } else if ( elem.getAttribute != undefined ) {
                        if ( value != undefined ) elem.setAttribute( name, value );
                        return elem.getAttribute( name, 2 );
                } else {
@@ -2912,6 +2923,8 @@ jQuery.macros = {
                 * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
                 * @result [ <p>Hello</p>, <p>And Again</p> ]
                 *
+                * @test isSet( $("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" ); 
+                *
                 * @name siblings
                 * @type jQuery
                 * @cat DOM/Traversing
@@ -2925,6 +2938,9 @@ jQuery.macros = {
                 * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
                 * @result [ <p class="selected">Hello Again</p> ]
                 *
+                * @test isSet( $("#sndp").siblings("[code]").get(), q("sap"), "Check for filtered siblings (has code child element)" ); 
+                * @test isSet( $("#sndp").siblings("[a]").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
+                *
                 * @name siblings
                 * @type jQuery
                 * @param String expr An expression to filter the sibling Elements with
@@ -3158,24 +3174,31 @@ jQuery.macros = {
                },
 
                /**
-                * Binds a particular event (like click) to a each of a set of match elements.
-                *
-                * @example $("p").bind( "click", function() { alert("Hello"); } )
+                * Binds a handler to a particular event (like click) for each matched element.
+                * The event handler is passed an event object that you can use to prevent
+                * default behaviour. To stop both default action and event bubbling, your handler
+                * has to return false.
+                *
+                * @example $("p").bind( "click", function() {
+                *   alert( $(this).text() );
+                * } )
                 * @before <p>Hello</p>
-                * @result [ <p>Hello</p> ]
-                *
-                * Cancel a default action and prevent it from bubbling by returning false
-                * from your function.
+                * @result alert("Hello")
                 *
                 * @example $("form").bind( "submit", function() { return false; } )
+                * @desc Cancel a default action and prevent it from bubbling by returning false
+                * from your function.
                 *
-                * Cancel a default action by using the preventDefault method.
-                *
-                * @example $("form").bind( "submit", function() { e.preventDefault(); } )
+                * @example $("form").bind( "submit", function(event) {
+                *   event.preventDefault();
+                * } );
+                * @desc Cancel only the default action by using the preventDefault method.
                 *
-                * Stop an event from bubbling by using the stopPropogation method.
                 *
-                * @example $("form").bind( "submit", function() { e.stopPropogation(); } )
+                * @example $("form").bind( "submit", function(event) {
+                *   event.stopPropagation();
+                * } )
+                * @desc Stop only an event from bubbling by using the stopPropagation method.
                 *
                 * @name bind
                 * @type jQuery