Ticket #8099 Updates per review

This commit is contained in:
rwldrn 2011-04-13 13:58:17 -04:00
parent 4fde550cb6
commit 59240d31c0
2 changed files with 10 additions and 12 deletions

13
src/effects.js vendored
View file

@ -1,6 +1,8 @@
(function( jQuery ) { (function( jQuery ) {
var elemdisplay = {}, var elemdisplay = {},
iframe = null,
iframeDoc = null,
rfxtypes = /^(?:toggle|show|hide)$/, rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId, timerId,
@ -558,11 +560,8 @@ function defaultDisplay( nodeName ) {
if ( display === "none" || display === "" ) { if ( display === "none" || display === "" ) {
var iframe = defaultDisplay.iframe,
iframeDoc = defaultDisplay.iframeDoc;
// No iframe to use yet, so create it // No iframe to use yet, so create it
if ( !defaultDisplay.iframe ) { if ( !iframe ) {
iframe = document.createElement( "iframe" ); iframe = document.createElement( "iframe" );
iframe.width = iframe.height = 0; iframe.width = iframe.height = 0;
@ -572,9 +571,6 @@ function defaultDisplay( nodeName ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write("<!doctype><html><body></body></html>"); iframeDoc.write("<!doctype><html><body></body></html>");
// Cache iframe element
defaultDisplay.iframe = iframe;
defaultDisplay.iframeDoc = iframeDoc;
} else { } else {
// Reuse previous iframe // Reuse previous iframe
@ -598,9 +594,6 @@ function defaultDisplay( nodeName ) {
return elemdisplay[ nodeName ]; return elemdisplay[ nodeName ];
} }
defaultDisplay.iframe = null;
defaultDisplay.iframeDoc = null;
})( jQuery ); })( jQuery );

View file

@ -163,8 +163,9 @@ test("Persist correct display value", function() {
}); });
test("show() resolves correct default display #8099", function() { test("show() resolves correct default display #8099", function() {
expect(5); expect(7);
var bug8099 = jQuery("<tt/>").appendTo("#main"); var bug8099 = jQuery("<tt/>").appendTo("#main"),
div8099 = jQuery("<div/>", { className: "hidden" }).appendTo("#main");
equals( bug8099.css("display"), "none", "default display override for all tt" ); equals( bug8099.css("display"), "none", "default display override for all tt" );
equals( bug8099.show().css("display"), "inline", "Correctly resolves display:inline" ); 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.hide().css("display"), "none", "default display override for all tt" );
equals( bug8099.show().css("display"), "inline", "Correctly resolves display:inline" ); 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(); bug8099.remove();
div8099.remove();
}); });