File tree Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,10 @@ jQuery.fn.extend({
61
61
} else {
62
62
for ( var i = 0 , j = this . length ; i < j ; i ++ ) {
63
63
var display = jQuery . css ( this [ i ] , "display" ) ;
64
-
65
- if ( display !== "none" ) {
66
- jQuery . data ( this [ i ] , "olddisplay" , display ) ;
67
- }
64
+
65
+ if ( ! jQuery . data ( this [ i ] , "olddisplay" ) && display !== "none" ) {
66
+ jQuery . data ( this [ i ] , "olddisplay" , display ) ;
67
+ }
68
68
}
69
69
70
70
// Set the display of the elements in a second loop
Original file line number Diff line number Diff line change @@ -130,6 +130,41 @@ test("show(Number) - other displays", function() {
130
130
} ) ;
131
131
} ) ;
132
132
133
+
134
+
135
+ // Supports #7397
136
+ test ( "Persist correct display value" , function ( ) {
137
+ expect ( 4 ) ;
138
+ QUnit . reset ( ) ;
139
+ stop ( ) ;
140
+
141
+ // #show-tests * is set display: none in CSS
142
+ jQuery ( "#main" ) . append ( '<div id="show-tests"><span style="position:absolute;"></span></div>' ) ;
143
+
144
+ var $span = jQuery ( "#show-tests span" ) ,
145
+ orig = $span . css ( "display" ) ,
146
+ num = 0 ;
147
+
148
+ equal ( orig , "none" , "Expecting to start at display: none" ) ;
149
+
150
+ $span . text ( 'Saving...' ) . fadeIn ( 100 , function ( ) {
151
+
152
+ equal ( $span . css ( "display" ) , "block" , "Expecting display: block" ) ;
153
+
154
+ $span . text ( 'Saved!' ) . fadeOut ( 100 , function ( ) {
155
+
156
+ equal ( $span . css ( "display" ) , "none" , "Expecting display: none" ) ;
157
+
158
+ $span . text ( 'Saving...' ) . fadeIn ( 100 , function ( ) {
159
+
160
+ equal ( $span . css ( "display" ) , "block" , "Expecting display: block" ) ;
161
+
162
+ start ( ) ;
163
+ } ) ;
164
+ } ) ;
165
+ } ) ;
166
+ } ) ;
167
+
133
168
test ( "animate(Hash, Object, Function)" , function ( ) {
134
169
expect ( 1 ) ;
135
170
stop ( ) ;
You can’t perform that action at this time.
0 commit comments