aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2013-02-01 17:22:08 +0400
committerDave Methvin <dave.methvin@gmail.com>2013-02-04 15:22:07 -0500
commitf3db084f7cc73379b0d6f5341c987e2a801ea032 (patch)
tree64a89004e60c206c3578b06c66633f87471c9a12 /test
parenta30785a4dde7430d11eeb94980831ffcca39e2f8 (diff)
downloadjquery-f3db084f7cc73379b0d6f5341c987e2a801ea032.tar.gz
jquery-f3db084f7cc73379b0d6f5341c987e2a801ea032.zip
Fix #13310. Get the right display value for disconnected nodes. Close gh-1156.
Diffstat (limited to 'test')
-rw-r--r--test/data/testsuite.css2
-rw-r--r--test/index.html1
-rw-r--r--test/unit/css.js23
3 files changed, 26 insertions, 0 deletions
diff --git a/test/data/testsuite.css b/test/data/testsuite.css
index 6bb3a5ded..1dfa7cd34 100644
--- a/test/data/testsuite.css
+++ b/test/data/testsuite.css
@@ -151,3 +151,5 @@ section { background:#f0f; display:block; }
/* #11971 */
#foo { background: url(1x1.jpg) right bottom no-repeat; }
+
+#display { display: list-item !important; }
diff --git a/test/index.html b/test/index.html
index 918d7d2d7..f073054d8 100644
--- a/test/index.html
+++ b/test/index.html
@@ -318,6 +318,7 @@ Z</textarea>
</div>
<div id="fx-tests"></div>
+ <span id="display"></span>
</div>
</div>
</dl>
diff --git a/test/unit/css.js b/test/unit/css.js
index 5ce12c73f..27069f8a3 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -970,4 +970,27 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
window.setTimeout( start, 1000 );
});
+asyncTest( "Make sure initialized display value for disconnected nodes is correct (#13310)", 4, function() {
+ var display = jQuery("#display").css("display"),
+ div = jQuery("<div/>");
+
+ equal( div.css( "display", "inline" ).hide().show().appendTo("body").css( "display" ), "inline", "Initialized display value has returned" );
+ div.remove();
+
+ div.css( "display", "none" ).hide();
+ equal( jQuery._data( div[ 0 ], "olddisplay" ), undefined, "olddisplay is undefined after hiding a detached and hidden element" );
+ div.remove();
+
+ div.css( "display", "inline-block" ).hide().appendTo("body").fadeIn(function() {
+ equal( div.css( "display" ), "inline-block", "Initialized display value has returned" );
+ div.remove();
+
+ start();
+ });
+
+ equal( jQuery._data( jQuery("#display").css( "display", "inline" ).hide()[ 0 ], "olddisplay" ), display,
+ "display: * !Important value should used as initialized display" );
+ jQuery._removeData( jQuery("#display")[ 0 ] );
+});
+
}