diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-04-03 18:18:32 -0400 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-03 19:13:41 -0400 |
commit | ad2b3bc9f908a8e529c4479c8c9baead23c2d827 (patch) | |
tree | a5bcf0f8f782983daaeaeeb3891f6752742278f6 /test | |
parent | 2a8a2b61488e7857b116bedc9eb75bd971772c2f (diff) | |
download | jquery-ad2b3bc9f908a8e529c4479c8c9baead23c2d827.tar.gz jquery-ad2b3bc9f908a8e529c4479c8c9baead23c2d827.zip |
Found a problem removing the style attribute in IE
- Style is now a special case in IE6/7 to set cssText. My goal is to avoid calling attr again for the performance benefit, and at this point it would also cause an infinite loop for the boolean attributes hooks such as selected & checked. Nevertheless, style seems to be the only one requiring a special call.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/attributes.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index ad051649f..0e86a8bf6 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -15,9 +15,9 @@ test("jQuery.attrFix integrity test", function() { if ( !jQuery.support.getSetAttribute ) { propsShouldBe = { tabindex: "tabIndex", + readonly: "readOnly", "for": "htmlFor", "class": "className", - readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", @@ -27,7 +27,8 @@ test("jQuery.attrFix integrity test", function() { }; } else { propsShouldBe = { - tabindex: "tabIndex" + tabindex: "tabIndex", + readonly: "readOnly" }; } @@ -172,7 +173,7 @@ test("attr(Hash)", function() { }); test("attr(String, Object)", function() { - expect(29); + expect(30); var div = jQuery("div").attr("foo", "bar"), fail = false; @@ -195,6 +196,8 @@ test("attr(String, Object)", function() { equals( jQuery("#name").attr('name'), undefined, 'Remove name attribute' ); jQuery("#check2").attr('checked', true); equals( document.getElementById('check2').checked, true, 'Set checked attribute' ); + jQuery("#check2").attr('checked', ''); + equals( document.getElementById('check2').checked, false, 'Setting checked to empty string removes it' ); jQuery("#check2").attr('checked', false); equals( document.getElementById('check2').checked, false, 'Set checked attribute' ); jQuery("#text1").attr('readonly', true); @@ -397,9 +400,11 @@ test("attr('tabindex', value)", function() { }); test("removeAttr(String)", function() { - expect(2); + expect(4); equals( jQuery('#mark').removeAttr( "class" )[0].className, "", "remove class" ); equals( jQuery('#form').removeAttr('id').attr('id'), undefined, 'Remove id' ); + equals( jQuery('#foo').attr('style', 'position:absolute;').removeAttr('style').attr('style'), undefined, 'Check removing style attribute' ); + equals( jQuery('#form').attr('style', 'position:absolute;').removeAttr('style').attr('style'), undefined, 'Check removing style attribute on a form' ); }); test("removeProp(String)", function() { |