fix for #3688, setting type attribute on button causes IE to throw error
[jquery.git] / test / unit / core.js
index 9befade..289a8ba 100644 (file)
@@ -463,7 +463,7 @@ test("attr(Hash)", function() {
 });
 
 test("attr(String, Object)", function() {
-       expect(19);
+       expect(21);
        var div = jQuery("div").attr("foo", "bar"),
                fail = false;
        for ( var i = 0; i < div.size(); i++ ) {
@@ -537,6 +537,16 @@ test("attr(String, Object)", function() {
        }
        ok( thrown, "Exception thrown when trying to change type property" );
        equals( "checkbox", check.attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
+       
+       var button = jQuery("#button");
+       var thrown = false;
+       try {
+               button.attr('type','submit');
+       } catch(e) {
+               thrown = true;
+       }
+       ok( thrown, "Exception thrown when trying to change type property" );
+       equals( "button", button.attr('type'), "Verify that you can't change the type of a button element" );
 });
 
 if ( !isLocal ) {
@@ -996,12 +1006,12 @@ test("prependTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
 
        reset();
        expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
-       jQuery([document.getElementById('yahoo'), document.getElementById('first')]).prependTo('#sap');
+       jQuery([document.getElementById('first'), document.getElementById('yahoo')]).prependTo('#sap');
        equals( expected, jQuery('#sap').text(), "Check for prepending of array of elements" );
 
        reset();
-       expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
-       jQuery("#yahoo, #first").prependTo('#sap');
+       expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
+       jQuery("#first, #yahoo").prependTo('#sap');
        equals( expected, jQuery('#sap').text(), "Check for prepending of jQuery object" );
 
        reset();
@@ -1090,12 +1100,12 @@ test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() {
 
        reset();
        expected = "This is a normal link: YahooTry them out:diveintomark";
-       jQuery([document.getElementById('mark'), document.getElementById('first')]).insertAfter('#yahoo');
+       jQuery([document.getElementById('first'), document.getElementById('mark')]).insertAfter('#yahoo');
        equals( expected, jQuery('#en').text(), "Insert array of elements after" );
 
        reset();
-       expected = "This is a normal link: YahooTry them out:diveintomark";
-       jQuery("#mark, #first").insertAfter('#yahoo');
+       expected = "This is a normal link: YahoodiveintomarkTry them out:";
+       jQuery("#first, #mark").insertAfter('#yahoo');
        equals( expected, jQuery('#en').text(), "Insert jQuery after" );
 });
 
@@ -1688,13 +1698,6 @@ test("jQuery.each(Object,Function)", function() {
         equals( total, 3, "Looping over an object, with break" );
 });
 
-test("jQuery.prop", function() {
-       expect(2);
-       var handle = function() { return this.id };
-       equals( jQuery.prop(jQuery("#ap")[0], handle), "ap", "Check with Function argument" );
-       equals( jQuery.prop(jQuery("#ap")[0], "value"), "value", "Check with value argument" );
-});
-
 test("jQuery.className", function() {
        expect(6);
        var x = jQuery("<p>Hi</p>")[0];
@@ -1713,7 +1716,7 @@ test("jQuery.className", function() {
 });
 
 test("remove()", function() {
-       expect(6);
+       expect(7);
        jQuery("#ap").children().remove();
        ok( jQuery("#ap").text().length > 10, "Check text is not removed" );
        equals( jQuery("#ap").children().length, 0, "Check remove" );
@@ -1723,6 +1726,9 @@ test("remove()", function() {
        ok( jQuery("#ap").text().length > 10, "Check text is not removed" );
        equals( jQuery("#ap").children().length, 1, "Check filtered remove" );
 
+       jQuery("#ap").children().remove("a, code");
+       equals( jQuery("#ap").children().length, 0, "Check multi-filtered remove" );
+
        // using contents will get comments regular, text, and comment nodes
        equals( jQuery("#nonnodes").contents().length, 3, "Check node,textnode,comment remove works" );
        jQuery("#nonnodes").contents().remove();