From: rwldrn Date: Wed, 13 Apr 2011 17:58:17 +0000 (-0400) Subject: Ticket #8099 Updates per review X-Git-Tag: 1.6b1~2^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59240d31c0c277a60fdc187e0fc9884007971106;p=jquery.git Ticket #8099 Updates per review --- diff --git a/src/effects.js b/src/effects.js index 828798cb5..460811cd9 100644 --- a/src/effects.js +++ b/src/effects.js @@ -1,6 +1,8 @@ (function( jQuery ) { var elemdisplay = {}, + iframe = null, + iframeDoc = null, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, timerId, @@ -558,11 +560,8 @@ function defaultDisplay( nodeName ) { if ( display === "none" || display === "" ) { - var iframe = defaultDisplay.iframe, - iframeDoc = defaultDisplay.iframeDoc; - // No iframe to use yet, so create it - if ( !defaultDisplay.iframe ) { + if ( !iframe ) { iframe = document.createElement( "iframe" ); iframe.width = iframe.height = 0; @@ -572,9 +571,6 @@ function defaultDisplay( nodeName ) { iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc.write(""); - // Cache iframe element - defaultDisplay.iframe = iframe; - defaultDisplay.iframeDoc = iframeDoc; } else { // Reuse previous iframe @@ -598,9 +594,6 @@ function defaultDisplay( nodeName ) { return elemdisplay[ nodeName ]; } -defaultDisplay.iframe = null; -defaultDisplay.iframeDoc = null; - })( jQuery ); diff --git a/test/unit/effects.js b/test/unit/effects.js index f3ccd218c..082128876 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -163,8 +163,9 @@ test("Persist correct display value", function() { }); test("show() resolves correct default display #8099", function() { - expect(5); - var bug8099 = jQuery("").appendTo("#main"); + expect(7); + var bug8099 = jQuery("").appendTo("#main"), + div8099 = jQuery("
", { className: "hidden" }).appendTo("#main"); equals( bug8099.css("display"), "none", "default display override for all tt" ); equals( bug8099.show().css("display"), "inline", "Correctly resolves display:inline" ); @@ -174,7 +175,11 @@ test("show() resolves correct default display #8099", function() { equals( bug8099.hide().css("display"), "none", "default display override for all tt" ); equals( bug8099.show().css("display"), "inline", "Correctly resolves display:inline" ); + equals( div8099.show().css("display"), "block", "default display override for all div.hidden" ); + equals( div8099.hide().css("display"), "none", "Correctly resolves display:none" ); + bug8099.remove(); + div8099.remove(); });