diff --git a/src/css.js b/src/css.js index 7abf95e98..76c2255ce 100644 --- a/src/css.js +++ b/src/css.js @@ -371,7 +371,7 @@ if ( jQuery.expr && jQuery.expr.filters ) { var width = elem.offsetWidth, height = elem.offsetHeight; - return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none"); + return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { diff --git a/test/unit/css.js b/test/unit/css.js index acad497eb..78c6def61 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1,7 +1,7 @@ module("css", { teardown: moduleTeardown }); test("css(String|Hash)", function() { - expect( 42 ); + expect( 44 ); equals( jQuery("#qunit-fixture").css("display"), "block", "Check for css property \"display\""); @@ -10,6 +10,8 @@ test("css(String|Hash)", function() { ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden"); jQuery("#nothiddendiv").css({display: "block"}); ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible"); + ok( jQuery(window).is(":visible"), "Calling is(':visible') on window does not throw an error in IE."); + ok( jQuery(document).is(":visible"), "Calling is(':visible') on document does not throw an error in IE."); var div = jQuery( "
" ); @@ -36,8 +38,8 @@ test("css(String|Hash)", function() { var width = parseFloat(jQuery("#nothiddendiv").css("width")), height = parseFloat(jQuery("#nothiddendiv").css("height")); jQuery("#nothiddendiv").css({ width: -1, height: -1 }); - equals( parseFloat(jQuery("#nothiddendiv").css("width")), width, "Test negative width ignored") - equals( parseFloat(jQuery("#nothiddendiv").css("height")), height, "Test negative height ignored") + equals( parseFloat(jQuery("#nothiddendiv").css("width")), width, "Test negative width ignored"); + equals( parseFloat(jQuery("#nothiddendiv").css("height")), height, "Test negative height ignored"); equals( jQuery("
").css("display"), "none", "Styles on disconnected nodes"); @@ -62,7 +64,8 @@ test("css(String|Hash)", function() { ok(true, "Requires the same number of tests"): ok( ~jQuery("#empty")[0].currentStyle.filter.indexOf("gradient"), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); - var div = jQuery("#nothiddendiv"), child = jQuery("#nothiddendivchild"); + div = jQuery("#nothiddendiv"); + var child = jQuery("#nothiddendivchild"); equals( parseInt(div.css("fontSize")), 16, "Verify fontSize px set." ); equals( parseInt(div.css("font-size")), 16, "Verify fontSize px set." ); @@ -227,7 +230,7 @@ test("css(String, Object)", function() { j.css("overflow", "visible"); equals( j.css("overflow"), "visible", "Check node,textnode,comment css works" ); // opera sometimes doesn't update 'display' correctly, see #2037 - jQuery("#t2037")[0].innerHTML = jQuery("#t2037")[0].innerHTML + 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"),