};
jQuery.fn.css = function( name, value ) {
+ // Setting 'undefined' is a no-op
+ if ( arguments.length === 2 && value === undefined ) {
+ return this;
+ }
+
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
});
test("css(String, Object)", function() {
- expect(19);
+ expect(21);
+
ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible');
jQuery('#nothiddendiv').css("display", 'none');
ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden');
// opera sometimes doesn't update 'display' correctly, see #2037
jQuery("#t2037")[0].innerHTML = jQuery("#t2037")[0].innerHTML
equals( jQuery("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
+
+ var div = jQuery("#nothiddendiv"),
+ display = div.css("display"),
+ ret = div.css("display", undefined);
+
+ equals( ret, div, "Make sure setting undefined returns the original set." );
+ equals( div.css("display"), display, "Make sure that the display wasn't changed." );
});
if(jQuery.browser.msie) {